From de4746a8a23295c377b428af82315676e4c060b3 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Thu, 27 Nov 2003 23:28:29 +0000 Subject: [PATCH] Initial release of the configure backup. It now uses backup_config instead of config. Not finished !! --- admin/backup.php | 51 ++++++++++++++++ admin/configure.php | 2 + admin/index.php | 2 + backup/config.html | 146 ++++++++++++++++++++++++++++++++++++++++++++ backup/lib.php | 22 +++++++ backup/version.php | 2 +- 6 files changed, 224 insertions(+), 1 deletion(-) create mode 100644 admin/backup.php create mode 100644 backup/config.html diff --git a/admin/backup.php b/admin/backup.php new file mode 100644 index 0000000000..fdab034dc1 --- /dev/null +++ b/admin/backup.php @@ -0,0 +1,51 @@ + $value) { + backup_set_config($name, $value); + } + redirect("$CFG->wwwroot/$CFG->admin/index.php", get_string("changessaved"), 1); + exit; + } + +/// Otherwise print the form. + + $stradmin = get_string("administration"); + $strconfiguration = get_string("configuration"); + $strbackup = get_string("backup"); + + print_header("$site->shortname: $strconfiguration: $strbackup", $site->fullname, + "$stradmin -> ". + "$strconfiguration -> ". + "$strbackup"); + + print_heading($strbackup); + + print_simple_box("
".get_string("adminhelpbackup")."
", "center", "50%"); + echo "
"; + + print_simple_box_start("center", "", "$THEME->cellheading"); + include("$CFG->dirroot/backup/config.html"); + print_simple_box_end(); + + print_footer(); + +?> diff --git a/admin/configure.php b/admin/configure.php index 79809452a3..d4e4d7e8d8 100644 --- a/admin/configure.php +++ b/admin/configure.php @@ -32,6 +32,8 @@ get_string("adminhelplanguage")); $table->data[] = array("".get_string("managemodules")."", get_string("adminhelpmanagemodules")); + $table->data[] = array("".get_string("backup")."", + get_string("adminhelpbackup")); print_table($table); diff --git a/admin/index.php b/admin/index.php index 02427c1567..b0cffd92f4 100644 --- a/admin/index.php +++ b/admin/index.php @@ -359,6 +359,8 @@ get_string("adminhelplanguage")."
"; $configdata .= " ".get_string("managemodules")." - ". get_string("adminhelpmanagemodules")."
"; + $configdata .= " ".get_string("backup")." - ". + get_string("adminhelpbackup")."
"; $table->data[] = array("".get_string("configuration")."", $configdata); diff --git a/backup/config.html b/backup/config.html new file mode 100644 index 0000000000..baa21a373a --- /dev/null +++ b/backup/config.html @@ -0,0 +1,146 @@ +backup_sche_modules)) { + $backup_config->backup_sche_modules = 1; + } + if (empty($backup_config->backup_sche_withuserdata)) { + $backup_config->backup_sche_withuserdata = 1; + } + if (empty($backup_config->backup_sche_users)) { + $backup_config->backup_sche_users = 1; + } + if (empty($backup_config->backup_sche_logs)) { + $backup_config->backup_sche_logs = 0; + } + if (empty($backup_config->backup_sche_userfiles)) { + $backup_config->backup_sche_userfiles = 1; + } + if (empty($backup_config->backup_sche_coursefiles)) { + $backup_config->backup_sche_coursefiles = 1; + } + if (empty($backup_config->backup_sche_weekdays)) { + $backup_config->backup_sche_weekdays = "0000000"; + } + +print_object($backup_config); + + //Yes/no array for use in yes/no menu + $yesno_array[0] = $no; + $yesno_array[1] = $yes; + + //With user data/without user data array for use in menu + $withwithout_array[0] = $withoutuserdata; + $withwithout_array[1] = $withuserdata; + + //Course/alla array for use in course/all menu + $courseall_array[0] = $all; + $courseall_array[1] = $course; +?> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

:

+ backup_sche_modules, "") ?> + backup_sche_withuserdata, "") ?> + + +

:

+ backup_sche_users, "") ?> + + +

:

+ backup_sche_logs, "") ?> + + +

:

+ backup_sche_userfiles, "") ?> + + +

:

+ backup_sche_coursefiles, "") ?> + + +
+ backup_sche_weekdays,$i,1) == "1") { + $strchecked = " checked"; + } else { + $strchecked = ""; + } + $check_names[] = ""; + $i++; + } + $table->align = array("center","center","center","center","center","center","center"); + $table->head = $day_names; + $table->data[] = $check_names; + print_table($table); + ?> +
+ ">
+ +
diff --git a/backup/lib.php b/backup/lib.php index b2d270fd51..cfec8597f6 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -2,6 +2,28 @@ //This file contains all the general function needed (file manipulation...) //not directly part of the backup/restore utility + //Sets a name/value pair in backup_config table + function backup_set_config($name, $value) { + if (get_field("backup_config", "name", "name", $name)) { + return set_field("backup_config", "value", $value, "name", $name); + } else { + $config->name = $name; + $config->value = $value; + return insert_record("backup_config", $config); + } + } + + //Gets all the information from backup_config table + function backup_get_config() { + $backup_config = null; + if ($configs = get_records('backup_config')) { + foreach ($configs as $config) { + $backup_config[$config->name] = $config->value; + } + } + return $backup_config; + } + //Delete old data in backup tables (if exists) //Two days seems to be apropiate function backup_delete_old_data() { diff --git a/backup/version.php b/backup/version.php index ad7fcf707d..3bec877a67 100644 --- a/backup/version.php +++ b/backup/version.php @@ -5,6 +5,6 @@ // database (backup_version) to determine whether upgrades should // be performed (see db/backup_*.php) -$backup_version = 2003112200; // The current version is a date (YYYYMMDDXX) +$backup_version = 2003112700; // The current version is a date (YYYYMMDDXX) $backup_release = "1.2 development"; // User-friendly version number -- 2.39.5