]> git.mjollnir.org Git - moodle.git/commitdiff
Added support for the new upgrade system for main tables.
authorstronk7 <stronk7>
Thu, 24 Aug 2006 22:27:11 +0000 (22:27 +0000)
committerstronk7 <stronk7>
Thu, 24 Aug 2006 22:27:11 +0000 (22:27 +0000)
admin/index.php

index 77accff9efabb45bfb54faa4ee5927e4f3946f54..00af173189405c0a8199f10a34c87f246c8dac39 100644 (file)
         include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php");  # defines old upgrades
     }
     if (file_exists("$CFG->dirroot/lib/db/upgrade.php") && $CFG->xmldb_enabled) {
-        include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php");  # defines new upgrades
+        include_once("$CFG->dirroot/lib/db/upgrade.php");  # defines new upgrades
     }
 
     $stradministration = get_string("administration");
                 upgrade_log_start();
                 print_heading($strdatabasechecking);
                 $db->debug=true;
-                if (main_upgrade($CFG->version)) {
+            /// Launch the old main upgrade
+                $status = main_upgrade($CFG->version);
+            /// If succesful and exists launch the new main upgrade (XMLDB), called xmldb_main_upgrade
+                if ($status && $CFG->xmldb_enabled && function_exists('xmldb_main_upgrade')) {
+                    $status = xmldb_main_upgrade($CFG->version);
+                }
+            /// If successful, continue upgrading roles and setting everything properly
+                if ($status) {
                     if (empty($CFG->rolesactive)) {
                         // Upgrade to the roles system.
                         moodle_install_roles();
                     } else {
                         notify("Upgrade failed!  (Could not update version in config table)");
                     }
+            /// Main upgrade not success
                 } else {
                     $db->debug=false;
                     notify("Upgrade failed!  See /version.php");
 
     admin_externalpage_print_footer();
 
-?>
\ No newline at end of file
+?>