### Eclipse Workspace Patch 1.0 #P moodle Index: admin/index.php =================================================================== RCS file: /cvsroot/moodle/moodle/admin/index.php,v retrieving revision 1.261 diff -u -r1.261 index.php --- admin/index.php 22 Jan 2007 20:15:15 -0000 1.261 +++ admin/index.php 22 Jan 2007 21:39:08 -0000 @@ -323,11 +323,14 @@ print_footer('none'); exit; } else { - notify("Upgrade failed! (Could not update version in config table)"); + error('Upgrade failed! (Could not update version in config table)'); } /// Main upgrade not success } else { - notify("Upgrade failed! See /version.php"); + notify('Main Upgrade failed! See lib/db/upgrade.php'); + print_continue('index.php?confirmupgrade=1&confirmrelease=1'); + print_footer('none'); + die; } upgrade_log_finish(); } @@ -346,7 +349,7 @@ if ($release <> $CFG->release) { // Update the release version if (!set_config("release", $release)) { - notify("ERROR: Could not update release version in database!!"); + error("ERROR: Could not update release version in database!!"); } } Index: lib/db/upgrade.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/db/upgrade.php,v retrieving revision 1.20 diff -u -r1.20 upgrade.php --- lib/db/upgrade.php 21 Jan 2007 23:37:55 -0000 1.20 +++ lib/db/upgrade.php 22 Jan 2007 21:39:14 -0000 @@ -31,6 +31,7 @@ drop_table(new XMLDBTable('user_coursecreators')); drop_table(new XMLDBTable('user_admins')); } + upgrade_status_main($result, 2006100401); } if ($oldversion < 2006100601) { /// Disable the exercise module because it's unmaintained @@ -48,12 +49,14 @@ rebuild_course_cache(); // Rebuld cache for all modules because they might have changed } } + upgrade_status_main($result, 2006100601); } if ($oldversion < 2006101001) { /// Disable the LAMS module by default if (!count_records('lams')) { set_field('modules', 'visible', 0, 'name', 'lams'); // Disable it by default } + upgrade_status_main($result, 2006101001); } if ($result && $oldversion < 2006102600) { @@ -80,6 +83,8 @@ $result = $result && add_field($table, $field3); $result = $result && add_field($table, $field4); $result = $result && add_field($table, $field5); + + upgrade_status_main($result, 2006102600); } if ($result && $oldversion < 2006112000) { @@ -91,6 +96,8 @@ /// Launch add field attachment $result = $result && add_field($table, $field); + + upgrade_status_main($result, 2006112000); } if ($result && $oldversion < 2006112200) { @@ -109,6 +116,8 @@ /// Launch add field screenreader $result = $result && add_field($table, $field); + + upgrade_status_main($result, 2006112200); } if ($oldversion < 2006120300) { /// Delete guest course section settings @@ -116,10 +125,12 @@ if ($guest = get_record('user', 'username', 'guest')) { execute_sql("DELETE FROM {$CFG->prefix}course_display where userid=$guest->id ;", true); } + upgrade_status_main($result, 2006120300); } if ($oldversion < 2006120400) { /// Remove secureforms config setting execute_sql("DELETE FROM {$CFG->prefix}config where name='secureforms' ;", true); + upgrade_status_main($result, 2006120400); } if ($oldversion < 2006120700) { // add moodle/user:viewdetails to all roles! @@ -129,6 +140,7 @@ assign_capability('moodle/user:viewdetails', CAP_ALLOW, $roleid, $context->id); } } + upgrade_status_main($result, 2006120700); } // Move the auth plugin settings into the config_plugin table @@ -151,6 +163,7 @@ break; // don't check the rest of the auth plugin names } } + upgrade_status_main($result, 2007010300); } if ($oldversion < 2007010301) { @@ -458,6 +471,7 @@ // Create the table $result = $result && create_table($table); + upgrade_status_main($result, 2007010301); } if ($result && $oldversion < 2007010404) { @@ -485,6 +499,7 @@ $result && update_record('user_info_field', $field); } } + upgrade_status_main($result, 2007010404); } if ($result && $oldversion < 2007011200) { @@ -508,7 +523,11 @@ /// code here to fill the context_rel table /// use get record set to iterate slower - build_context_rel(); + if ($result) { + build_context_rel(); + } + + upgrade_status_main($result, 2007011200); } if ($result && $oldversion < 2007011501) { @@ -522,6 +541,7 @@ unset_config('enablerecordcache'); unset($CFG->enablerecordcache); } + upgrade_status_main($result, 2007011501); } if ($result && $oldversion < 2007012100) { @@ -557,6 +577,7 @@ } } } + upgrade_status_main($result, 2007012100); } if ($result && $oldversion < 2007012101) { @@ -576,6 +597,8 @@ /// Launch change of precision for field user->lang $result = $result && change_field_precision($table, $field); + + upgrade_status_main($result, 2007012101); } return $result; Index: lib/adminlib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/adminlib.php,v retrieving revision 1.112 diff -u -r1.112 adminlib.php --- lib/adminlib.php 22 Jan 2007 20:15:12 -0000 1.112 +++ lib/adminlib.php 22 Jan 2007 21:39:14 -0000 @@ -9,6 +9,36 @@ * @package moodlecore */ +function upgrade_status_main($result, $version) { + global $CFG; + + if ($result) { + if ($CFG->version >= $version) { + // something really wrong is going on during main upgrade script + error("Can not upgrade main version from $CFG->version to $version."); + } + set_config('version', $version); + } else { + notify ("Error during main upgrade to version $version"); + } +} + +function upgrade_status_mod($result, $version, $type) { + //TODO +} + +function upgrade_status_plugin($result, $version, $type, $dir) { + //TODO +} + +function upgrade_status_backup($result, $version) { + //TODO +} + +function upgrade_status_blocks($result, $version, $type) { + //TODO +} + /** * Upgrade plugins *