diff --git a/admin/cliupgrade.php b/admin/cliupgrade.php index 7839192389f..4fb750a8453 100644 --- a/admin/cliupgrade.php +++ b/admin/cliupgrade.php @@ -998,14 +998,6 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) { } upgrade_plugins('qtype', 'question/type', ''); // Don't return anywhere - /// Upgrade backup/restore system if necessary - /// first old *.php update and then the new upgrade.php script - require_once("$CFG->dirroot/backup/lib.php"); - if ( $verbose > CLI_NO ) { - print_heading(get_string('upgradingbackupdb','install'),'',1); - } - upgrade_backup_db(''); // Don't return anywhere - /// Upgrade blocks system if necessary /// first old *.php update and then the new upgrade.php script require_once("$CFG->dirroot/lib/blocklib.php"); diff --git a/admin/settings/courses.php b/admin/settings/courses.php index e95bb448eae..a884a46dc42 100644 --- a/admin/settings/courses.php +++ b/admin/settings/courses.php @@ -132,45 +132,43 @@ if ($hassiteconfig } /// "backups" settingpage - if (!empty($CFG->backup_version)) { - $temp = new admin_settingpage('backups', get_string('backups','admin'), 'moodle/site:backup'); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0)); - $temp->add(new admin_setting_configselect('backup/backup_sche_users', get_string('users'), get_string('backupusershelp'), - 0, array(0 => get_string('all'), 1 => get_string('course')))); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup_sche_gradebook_history', get_string('gradebookhistories', 'grades'), get_string('backupgradebookhistoryhelp'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_blogs', get_string('blogs', 'blog'), get_string('backupblogshelp','blog'), 0)); + $temp = new admin_settingpage('backups', get_string('backups','admin'), 'moodle/site:backup'); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_modules', get_string('includemodules'), get_string('backupincludemoduleshelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_withuserdata', get_string('includemoduleuserdata'), get_string('backupincludemoduleuserdatahelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_metacourse', get_string('metacourse'), get_string('backupmetacoursehelp'), 0)); + $temp->add(new admin_setting_configselect('backup/backup_sche_users', get_string('users'), get_string('backupusershelp'), + 0, array(0 => get_string('all'), 1 => get_string('course')))); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_logs', get_string('logs'), get_string('backuplogshelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_userfiles', get_string('userfiles'), get_string('backupuserfileshelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_coursefiles', get_string('coursefiles'), get_string('backupcoursefileshelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_sitefiles', get_string('sitefiles'), get_string('backupsitefileshelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup_sche_gradebook_history', get_string('gradebookhistories', 'grades'), get_string('backupgradebookhistoryhelp'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_messages', get_string('messages', 'message'), get_string('backupmessageshelp','message'), 0)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_blogs', get_string('blogs', 'blog'), get_string('backupblogshelp','blog'), 0)); - $keepoptoins = array( - 0 => get_string('all'), 1 => '1', - 2 => '2', - 5 => '5', - 10 => '10', - 20 => '20', - 30 => '30', - 40 => '40', - 50 => '50', - 100 => '100', - 200 => '200', - 300 => '300', - 400 => '400', - 500 => '500'); - $temp->add(new admin_setting_configselect('backup/backup_sche_keep', get_string('keep'), - get_string('backupkeephelp'), 1, $keepoptoins)); - $temp->add(new admin_setting_configcheckbox('backup/backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0)); - $temp->add(new admin_setting_special_backupdays()); - $temp->add(new admin_setting_configtime('backup/backup_sche_hour', 'backup_sche_minute', get_string('executeat'), - get_string('backupexecuteathelp'), array('h' => 0, 'm' => 0))); - $temp->add(new admin_setting_configdirectory('backup/backup_sche_destination', get_string('saveto'), get_string('backupsavetohelp'), '')); + $keepoptoins = array( + 0 => get_string('all'), 1 => '1', + 2 => '2', + 5 => '5', + 10 => '10', + 20 => '20', + 30 => '30', + 40 => '40', + 50 => '50', + 100 => '100', + 200 => '200', + 300 => '300', + 400 => '400', + 500 => '500'); + $temp->add(new admin_setting_configselect('backup/backup_sche_keep', get_string('keep'), + get_string('backupkeephelp'), 1, $keepoptoins)); + $temp->add(new admin_setting_configcheckbox('backup/backup_sche_active', get_string('active'), get_string('backupactivehelp'), 0)); + $temp->add(new admin_setting_special_backupdays()); + $temp->add(new admin_setting_configtime('backup/backup_sche_hour', 'backup_sche_minute', get_string('executeat'), + get_string('backupexecuteathelp'), array('h' => 0, 'm' => 0))); + $temp->add(new admin_setting_configdirectory('backup/backup_sche_destination', get_string('saveto'), get_string('backupsavetohelp'), '')); - $ADMIN->add('courses', $temp); - } + $ADMIN->add('courses', $temp); } // end of speedup diff --git a/backup/backup.php b/backup/backup.php index 630bd51f553..3c969b4de1c 100644 --- a/backup/backup.php +++ b/backup/backup.php @@ -42,14 +42,6 @@ //Check necessary functions exists. Thanks to gregb@crowncollege.edu backup_required_functions(); - //Check backup_version - if ($id) { - $linkto = "backup.php?id=".$id.((!empty($to)) ? '&to='.$to : ''); - } else { - $linkto = "backup.php"; - } - upgrade_backup_db($linkto); - //Get strings if (empty($to)) { $strcoursebackup = get_string("coursebackup"); diff --git a/backup/db/install.xml b/backup/db/install.xml deleted file mode 100644 index 5d0ab6ec4b5..00000000000 --- a/backup/db/install.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - -
- - - - - - - - - - - - - -
- - - - - - - - - - - - -
-
-
diff --git a/backup/db/upgrade.php b/backup/db/upgrade.php deleted file mode 100644 index e75c1266ff9..00000000000 --- a/backup/db/upgrade.php +++ /dev/null @@ -1,41 +0,0 @@ -get_manager(); - $result = true; - -/// And upgrade begins here. For each one, you'll need one -/// block of code similar to the next one. Please, delete -/// this comment lines once this file start handling proper -/// upgrade code. - -/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php -/// $result = result of database_manager methods -/// } - - return $result; -} - -?> diff --git a/backup/lib.php b/backup/lib.php index 14772eff4f0..f794d714178 100644 --- a/backup/lib.php +++ b/backup/lib.php @@ -314,126 +314,6 @@ // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - function upgrade_backup_db($continueto) { - /// This function upgrades the backup tables, if necessary - /// It's called from admin/index.php, also backup.php and restore.php - - global $CFG, $DB, $interactive, $DB; - - require_once ("$CFG->dirroot/backup/version.php"); // Get code versions - - if (empty($CFG->backup_version)) { // Backup has never been installed. - $strdatabaseupgrades = get_string("databaseupgrades"); - $navlinks = array(); - $navlinks[] = array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc'); - $navigation = build_navigation($navlinks); - - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) { - print_header($strdatabaseupgrades, $strdatabaseupgrades, $navigation, "", - upgrade_get_javascript(), false, " ", " "); - } - - upgrade_log_start(); - print_heading('backup'); - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) { - $DB->set_debug(true); - } - - /// Both old .sql files and new install.xml are supported - /// but we priorize install.xml (XMLDB) if present - $DB->get_manager()->install_from_xmldb_file($CFG->dirroot . '/backup/db/install.xml'); //New method - $status = true; - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) { - $DB->set_debug(false); - } - if ($status) { - if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) { - notify(get_string("databasesuccess"), "green"); - notify(get_string("databaseupgradebackups", "", $backup_version), "green"); - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) { - print_continue($continueto); - print_footer('none'); - exit; - } else if ( CLI_UPGRADE && ($interative > CLI_SEMI ) ) { - console_write(STDOUT,'askcontinue'); - if (read_boolean()){ - return ; - }else { - console_write(STDERR,'','',false); - } - } - } else { - print_error("upgradeversionfail"); - } - } else { - print_error("backuptablefail"); - } - } - - /// Upgrading code starts here - $newupgrade = false; - if (is_readable($CFG->dirroot . '/backup/db/upgrade.php')) { - include_once($CFG->dirroot . '/backup/db/upgrade.php'); // defines new upgrading function - $newupgrade = true; - } - - if ($backup_version > $CFG->backup_version) { // Upgrade tables - $strdatabaseupgrades = get_string("databaseupgrades"); - $navigation = array(array('name' => $strdatabaseupgrades, 'link' => null, 'type' => 'misc')); - print_header($strdatabaseupgrades, $strdatabaseupgrades, build_navigation($navigation), '', upgrade_get_javascript()); - - upgrade_log_start(); - print_heading('backup'); - - /// Run de old and new upgrade functions for the module - $newupgrade_function = 'xmldb_backup_upgrade'; - - /// Then, the new function if exists and the old one was ok - $newupgrade_status = true; - if ($newupgrade && function_exists($newupgrade_function)) { - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) { - $DB->set_debug(true); - } - $newupgrade_status = $newupgrade_function($CFG->backup_version); - } else if ($newupgrade) { - notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' . - '/backup/db/upgrade.php'); - } - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) { - $DB->set_debug(false); - } - /// Now analyze upgrade results - if ($newupgrade_status) { // No upgrading failed - if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) { - notify(get_string("databasesuccess"), "green"); - notify(get_string("databaseupgradebackups", "", $backup_version), "green"); - if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) { - print_continue($continueto); - print_footer('none'); - exit; - } else if (CLI_UPGRADE) { - console_write(STDOUT,'askcontinue'); - if (read_boolean()){ - return ; - }else { - console_write(STDERR,'','',false); - } - } - } else { - print_error("upgradeversionfail"); - } - } else { - print_error('upgradefail', '', '','See backup/version.php'); - } - - } else if ($backup_version < $CFG->backup_version) { - upgrade_log_start(); - notify("WARNING!!! The code you are using is OLDER than the version that made these databases!"); - } - upgrade_log_finish(); - } - - //This function is used to insert records in the backup_ids table //If the info field is greater than max_db_storage, then its info //is saved to filesystem diff --git a/backup/restore.php b/backup/restore.php index b2c22cc2286..af07a59054d 100644 --- a/backup/restore.php +++ b/backup/restore.php @@ -89,14 +89,6 @@ //Check necessary functions exists. Thanks to gregb@crowncollege.edu backup_required_functions(); - //Check backup_version - if ($file) { - $linkto = "restore.php?id=".$id."&file=".$file; - } else { - $linkto = "restore.php"; - } - upgrade_backup_db($linkto); - //Get strings if (empty($to)) { $strcourserestore = get_string("courserestore"); diff --git a/backup/version.php b/backup/version.php deleted file mode 100644 index 29bac4a6466..00000000000 --- a/backup/version.php +++ /dev/null @@ -1,12 +0,0 @@ - diff --git a/lib/adminlib.php b/lib/adminlib.php index 5ae04cb5780..7c770ca137e 100644 --- a/lib/adminlib.php +++ b/lib/adminlib.php @@ -156,7 +156,10 @@ function upgrade_db($version, $release) { 'style' => 'default', 'template' => 'default', 'theme' => 'standardwhite', - 'filter_multilang_converted' => 1)); + 'filter_multilang_converted' => 1, + 'backup_version' => 2008111700, + 'backup_release' => '2.0 dev', + )); // store main version if (!set_config('version', $version)) { @@ -373,11 +376,6 @@ function upgrade_db($version, $release) { /// It is important that this is done AFTER the quiz module has been upgraded upgrade_plugins('qtype', 'question/type', $return_url); // Return here afterwards -/// Upgrade backup/restore system if necessary -/// first old *.php update and then the new upgrade.php script - require_once("$CFG->dirroot/backup/lib.php"); - upgrade_backup_db($return_url); // Return here afterwards - /// Upgrade blocks system if necessary /// first old *.php update and then the new upgrade.php script require_once("$CFG->dirroot/lib/blocklib.php"); @@ -658,10 +656,6 @@ function upgrade_plugin_savepoint($result, $version, $type, $dir) { } } -function upgrade_backup_savepoint($result, $version) { - //TODO -} - /** * Delete all plugin tables * @name string name of plugin, used as table prefix @@ -764,9 +758,6 @@ function get_db_directories() { } } -/// Now, backup/restore stuff (backup/db) - $dbdirs[] = $CFG->dirroot.'/backup/db'; - /// Now, block system stuff (blocks/db) $dbdirs[] = $CFG->dirroot.'/blocks/db'; diff --git a/lib/db/install.xml b/lib/db/install.xml index e66d7f2cfae..4d47acf30f5 100644 --- a/lib/db/install.xml +++ b/lib/db/install.xml @@ -1,5 +1,5 @@ - @@ -2003,7 +2003,7 @@ - +
@@ -2014,6 +2014,74 @@
+ + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + +