]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17847 moved backup install.xml and upgrade.php to core
authorskodak <skodak>
Sat, 10 Jan 2009 20:03:08 +0000 (20:03 +0000)
committerskodak <skodak>
Sat, 10 Jan 2009 20:03:08 +0000 (20:03 +0000)
admin/cliupgrade.php
admin/settings/courses.php
backup/backup.php
backup/db/install.xml [deleted file]
backup/db/upgrade.php [deleted file]
backup/lib.php
backup/restore.php
backup/version.php [deleted file]
lib/adminlib.php
lib/db/install.xml

index 7839192389ffafe77d18376f90eac135fe6ce530..4fb750a845340baeadeb208ee2bf7e50ee0dda7a 100644 (file)
@@ -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");
index e95bb448eae146bee43a626094d8a8c6894f83b6..a884a46dc42c38aceb16eeb6b99fd6cad1e6ad97 100644 (file)
@@ -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));
-
-        $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'), ''));
+    $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'), ''));
 
-        $ADMIN->add('courses', $temp);
-    }
+    $ADMIN->add('courses', $temp);
 
 } // end of speedup
 
index 630bd51f553d3075e3146c3bd55c2acf3b49deab..3c969b4de1cc447b412922e9edd807f0df0a30c1 100644 (file)
     //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 (file)
index 5d0ab6e..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="backup/db" VERSION="20060807" COMMENT="XMLDB file for Moodle backup tables">
-  <TABLES>
-    <TABLE NAME="backup_files" COMMENT="To store and recode ids to user and course files" NEXT="backup_ids">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="backup_code"/>
-        <FIELD NAME="backup_code" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="file_type"/>
-        <FIELD NAME="file_type" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="backup_code" NEXT="path"/>
-        <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="file_type" NEXT="old_id"/>
-        <FIELD NAME="old_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="path" NEXT="new_id"/>
-        <FIELD NAME="new_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="old_id"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="backup_code-file_type-path"/>
-        <KEY NAME="backup_code-file_type-path" TYPE="unique" FIELDS="backup_code, file_type, path" PREVIOUS="primary"/>
-      </KEYS>
-    </TABLE>
-    <TABLE NAME="backup_ids" COMMENT="To store and convert ids in backup/restore" PREVIOUS="backup_files" NEXT="backup_config">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="backup_code"/>
-        <FIELD NAME="backup_code" TYPE="int" LENGTH="12" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="table_name"/>
-        <FIELD NAME="table_name" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="backup_code" NEXT="old_id"/>
-        <FIELD NAME="old_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="table_name" NEXT="new_id"/>
-        <FIELD NAME="new_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="old_id" NEXT="info"/>
-        <FIELD NAME="info" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="new_id"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="backup_code-table_name-old_id"/>
-        <KEY NAME="backup_code-table_name-old_id" TYPE="unique" FIELDS="backup_code, table_name, old_id" PREVIOUS="primary"/>
-      </KEYS>
-    </TABLE>
-    <TABLE NAME="backup_config" COMMENT="To store backup configuration variables" PREVIOUS="backup_ids" NEXT="backup_courses">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="value"/>
-        <FIELD NAME="value" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" />
-      </KEYS>
-      <INDEXES>
-        <INDEX NAME="name" UNIQUE="true" FIELDS="name"/>
-      </INDEXES>
-    </TABLE>
-    <TABLE NAME="backup_courses" COMMENT="To store every course backup status" PREVIOUS="backup_config" NEXT="backup_log">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
-        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="laststarttime"/>
-        <FIELD NAME="laststarttime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="lastendtime"/>
-        <FIELD NAME="lastendtime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="laststarttime" NEXT="laststatus"/>
-        <FIELD NAME="laststatus" TYPE="char" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lastendtime" NEXT="nextstarttime"/>
-        <FIELD NAME="nextstarttime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="laststatus"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="courseid"/>
-        <KEY NAME="courseid" TYPE="unique" FIELDS="courseid" PREVIOUS="primary"/>
-      </KEYS>
-    </TABLE>
-    <TABLE NAME="backup_log" COMMENT="To store every course backup log info" PREVIOUS="backup_courses">
-      <FIELDS>
-        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
-        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="time"/>
-        <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="laststarttime"/>
-        <FIELD NAME="laststarttime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="time" NEXT="info"/>
-        <FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="laststarttime"/>
-      </FIELDS>
-      <KEYS>
-        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="courseid"/>
-        <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="backup_courses" REFFIELDS="courseid" PREVIOUS="primary"/>
-      </KEYS>
-    </TABLE>
-  </TABLES>
-</XMLDB>
diff --git a/backup/db/upgrade.php b/backup/db/upgrade.php
deleted file mode 100644 (file)
index e75c126..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php  //$Id$
-
-// This file keeps track of upgrades to 
-// the backup system
-//
-// Sometimes, changes between versions involve
-// alterations to database structures and other
-// major things that may break installations.
-//
-// The upgrade function in this file will attempt
-// to perform all the necessary actions to upgrade
-// your older installtion to the current version.
-//
-// If there's something it cannot do itself, it
-// will tell you what you need to do.
-//
-// The commands in here will all be database-neutral,
-// using the methods of database_manager class
-//
-// Please do not forget to use upgrade_set_timeout()
-// before any action that may take longer time to finish.
-
-function xmldb_backup_upgrade($oldversion) {
-    global $CFG, $DB;
-
-    $dbman = $DB->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;
-}
-
-?>
index 14772eff4f06e47369c4163f6e21ea7612577831..f794d7141781d9bb3e5cedb38056ac239d8e964b 100644 (file)
     // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 
-    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, "&nbsp;", "&nbsp;");
-        }
-
-            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
index b2c22cc2286ebbe0285d2db17e193f2caecbc890..af07a59054dfc16f9e5d966ba7f999836f27c7da 100644 (file)
     //Check necessary functions exists. Thanks to gregb@crowncollege.edu
     backup_required_functions();
 
-    //Check backup_version
-    if ($file) {
-        $linkto = "restore.php?id=".$id."&amp;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 (file)
index 29bac4a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php  //$Id$
-
-/// This file defines the current version of the
-/// backup/restore code that is being used.  This can be
-/// compared against the values stored in the 
-/// database (backup_version) to determine whether upgrades should
-/// be performed (see db/backup_*.php)
-
-    $backup_version = 2008111700;   // The current version is a date (YYYYMMDDXX)
-    $backup_release = '2.0 dev';     // User-friendly version number
-
-?>
index 5ae04cb5780659c93ff61626d09cdd271411779a..7c770ca137ed653114ae7f0fd5e8e852dc6584f4 100644 (file)
@@ -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';
 
index e66d7f2cfaef209b147959437916e1a3b80bc6bd..4d47acf30f5d5bf4b2e0290e1fb09bc0e141f93d 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20090106" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20090110" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="repository_instance_config" COMMENT="The config for intances" PREVIOUS="repository_instances">
+    <TABLE NAME="repository_instance_config" COMMENT="The config for intances" PREVIOUS="repository_instances" NEXT="backup_config">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="instanceid"/>
         <FIELD NAME="instanceid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="name"/>
         <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
       </KEYS>
     </TABLE>
+    <TABLE NAME="backup_config" COMMENT="To store backup configuration variables" PREVIOUS="repository_instance_config" NEXT="backup_files">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="name"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="value"/>
+        <FIELD NAME="value" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="name"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+      </KEYS>
+      <INDEXES>
+        <INDEX NAME="name" UNIQUE="true" FIELDS="name"/>
+      </INDEXES>
+    </TABLE>
+    <TABLE NAME="backup_files" COMMENT="To store and recode ids to user and course files" PREVIOUS="backup_config" NEXT="backup_ids">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="backup_code"/>
+        <FIELD NAME="backup_code" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="file_type"/>
+        <FIELD NAME="file_type" TYPE="char" LENGTH="10" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="backup_code" NEXT="path"/>
+        <FIELD NAME="path" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="file_type" NEXT="old_id"/>
+        <FIELD NAME="old_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="path" NEXT="new_id"/>
+        <FIELD NAME="new_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="old_id"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="backup_code-file_type-path"/>
+        <KEY NAME="backup_code-file_type-path" TYPE="unique" FIELDS="backup_code, file_type, path" PREVIOUS="primary"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="backup_ids" COMMENT="To store and convert ids in backup/restore" PREVIOUS="backup_files" NEXT="backup_courses">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="backup_code"/>
+        <FIELD NAME="backup_code" TYPE="int" LENGTH="12" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="table_name"/>
+        <FIELD NAME="table_name" TYPE="char" LENGTH="30" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="backup_code" NEXT="old_id"/>
+        <FIELD NAME="old_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="table_name" NEXT="new_id"/>
+        <FIELD NAME="new_id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="old_id" NEXT="info"/>
+        <FIELD NAME="info" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="new_id"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="backup_code-table_name-old_id"/>
+        <KEY NAME="backup_code-table_name-old_id" TYPE="unique" FIELDS="backup_code, table_name, old_id" PREVIOUS="primary"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="backup_courses" COMMENT="To store every course backup status" PREVIOUS="backup_ids" NEXT="backup_log">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
+        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="laststarttime"/>
+        <FIELD NAME="laststarttime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="lastendtime"/>
+        <FIELD NAME="lastendtime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="laststarttime" NEXT="laststatus"/>
+        <FIELD NAME="laststatus" TYPE="char" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="lastendtime" NEXT="nextstarttime"/>
+        <FIELD NAME="nextstarttime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="laststatus"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="courseid"/>
+        <KEY NAME="courseid" TYPE="unique" FIELDS="courseid" PREVIOUS="primary"/>
+      </KEYS>
+    </TABLE>
+    <TABLE NAME="backup_log" COMMENT="To store every course backup log info" PREVIOUS="backup_courses">
+      <FIELDS>
+        <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" ENUM="false" NEXT="courseid"/>
+        <FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="id" NEXT="time"/>
+        <FIELD NAME="time" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="courseid" NEXT="laststarttime"/>
+        <FIELD NAME="laststarttime" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="time" NEXT="info"/>
+        <FIELD NAME="info" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="laststarttime"/>
+      </FIELDS>
+      <KEYS>
+        <KEY NAME="primary" TYPE="primary" FIELDS="id" NEXT="courseid"/>
+        <KEY NAME="courseid" TYPE="foreign" FIELDS="courseid" REFTABLE="backup_courses" REFFIELDS="courseid" PREVIOUS="primary"/>
+      </KEYS>
+    </TABLE>
   </TABLES>
   <STATEMENTS>
     <STATEMENT NAME="insert mnet_application" TYPE="insert" TABLE="mnet_application" COMMENT="Initial insert of records on table mnet_application" NEXT="insert log_display">