]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16002 rewritten upgrade locking and better upgrade progress tracking; MDL-16070...
authorskodak <skodak>
Sat, 16 Aug 2008 12:16:01 +0000 (12:16 +0000)
committerskodak <skodak>
Sat, 16 Aug 2008 12:16:01 +0000 (12:16 +0000)
85 files changed:
admin/auth_config.php
admin/cliupgrade.php
admin/index.php
admin/lang.php
admin/settings/misc.php
backup/db/upgrade.php
blocks/activity_modules/db/upgrade.php
blocks/admin/db/upgrade.php
blocks/calendar_month/db/upgrade.php
blocks/calendar_upcoming/db/upgrade.php
blocks/course_list/db/upgrade.php
blocks/course_summary/db/upgrade.php
blocks/db/upgrade.php
blocks/news_items/db/upgrade.php
blocks/online_users/db/upgrade.php
blocks/participants/db/upgrade.php
blocks/recent_activity/db/upgrade.php
blocks/rss_client/db/upgrade.php
blocks/search/config_global.html
blocks/search/db/upgrade.php
blocks/search_forums/db/upgrade.php
blocks/section_links/db/upgrade.php
blocks/social_activities/db/upgrade.php
course/format/README.txt
enrol/authorize/db/upgrade.php
enrol/paypal/db/upgrade.php
lang/en_utf8/admin.php
lang/en_utf8/data.php
lang/en_utf8/debug.php
lang/en_utf8/error.php
lang/en_utf8/forum.php
lib/accesslib.php
lib/adminlib.php
lib/blocklib.php
lib/db/upgrade.php
lib/db/upgradelib.php
lib/moodlelib.php
lib/pagelib.php
lib/setup.php
lib/weblib.php
message/output/email/db/upgrade.php
message/output/jabber/db/upgrade.php
message/output/popup/db/upgrade.php
mod/assignment/db/upgrade.php
mod/assignment/lib.php
mod/chat/db/upgrade.php
mod/choice/db/upgrade.php
mod/data/db/upgrade.php
mod/data/lib.php
mod/data/rate.php
mod/feedback/db/upgrade.php
mod/forum/db/upgrade.php
mod/forum/lib.php
mod/forum/rate.php
mod/glossary/db/upgrade.php
mod/glossary/lib.php
mod/glossary/rate.php
mod/hotpot/db/upgrade.php
mod/hotpot/lib.php
mod/label/db/upgrade.php
mod/lesson/db/upgrade.php
mod/lesson/lib.php
mod/quiz/db/upgrade.php
mod/quiz/lib.php
mod/quiz/pagelib.php
mod/quiz/report/overview/db/upgrade.php
mod/quiz/report/statistics/db/upgrade.php
mod/resource/db/upgrade.php
mod/scorm/db/upgrade.php
mod/scorm/lib.php
mod/survey/db/upgrade.php
mod/wiki/db/upgrade.php
question/type/calculated/db/upgrade.php
question/type/datasetdependent/db/upgrade.php
question/type/essay/db/upgrade.php
question/type/match/db/upgrade.php
question/type/multianswer/db/upgrade.php
question/type/multichoice/db/upgrade.php
question/type/numerical/db/upgrade.php
question/type/randomsamatch/db/upgrade.php
question/type/shortanswer/db/upgrade.php
question/type/truefalse/db/upgrade.php
search/query.php
user/editlib.php
version.php

index 4e0b2886eb78483ff1a3fdba6b70e388ede496d4..902d78906f05a883aa058218b77d9dcf9237bd12 100644 (file)
@@ -33,7 +33,7 @@ if ($frm = data_submitted() and confirm_sesskey()) {
                     $plugin = "auth/$auth";
                     $name   = $matches[1];
                     if (!set_config($name, $value, $plugin)) {
-                        print_error("cannotsaveconfig", 'error', '', array($name, $value, $plugin));
+                        print_error("cannotsaveconfig", 'error', '', (object)array('name'=>$name, 'value'=>$value, 'plugin'=>$plugin));
                     }
                 }
             }
index b4cb4642d3ff1bede075313897ebdc55dc6fd7cc..99db2d4789e8bcd72cb393012c40ad7790251194 100644 (file)
@@ -819,9 +819,6 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
 
         $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
 
-        // all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
-        set_config('unicodedb', 1);
-
         /// Continue with the instalation
 
             // Install the roles system.
@@ -868,12 +865,6 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
     if ($CFG->version) {
         if ($version > $CFG->version) {  // upgrade
 
-            /// If the database is not already Unicode then we do not allow upgrading!
-            /// Instead, we print an error telling them to upgrade to 1.7 first.  MDL-6857
-            if (empty($CFG->unicodedb)) {
-                console_write(STDERR,'unicodeupgradeerror', 'error');
-            }
-
             $a->oldversion = "$CFG->release ($CFG->version)";
             $a->newversion = "$release ($version)";
             $strdatabasechecking = get_string("databasechecking", "", $a);
index 8d84fdd1eb83c7d590d5af683ed39823adc5b224..09ebde323c8dac09014c6c9fbc879e8becf3e408 100644 (file)
         die;
     }
 
-/// Turn off time limits and try to flush everything all the time, sometimes upgrades can be slow.
-
-    @set_time_limit(0);
+/// try to flush everything all the time
     @ob_implicit_flush(true);
     while(@ob_end_clean()); // ob_end_flush prevents sending of headers
 
 
-    require_once('../config.php');
-    require_once($CFG->libdir.'/adminlib.php');  // Contains various admin-only functions
-    require_once($CFG->libdir.'/db/upgradelib.php');  // Upgrade-related functions
+    require('../config.php');
+    require_once($CFG->libdir.'/adminlib.php');        // Contains various admin-only functions
 
     $id             = optional_param('id', '', PARAM_TEXT);
     $confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
     $confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
+    $confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
     $agreelicense   = optional_param('agreelicense', 0, PARAM_BOOL);
     $autopilot      = optional_param('autopilot', 0, PARAM_BOOL);
-    $ignoreupgradewarning = optional_param('ignoreupgradewarning', 0, PARAM_BOOL);
-    $confirmplugincheck = optional_param('confirmplugincheck', 0, PARAM_BOOL);
-
-/// check upgrade status first
-    if ($ignoreupgradewarning) {
-        $SESSION->upgraderunning = 0;
-    }
-    upgrade_check_running("Upgrade already running in this session, please wait!<br />Click on the exclamation marks to ignore this warning (<a href=\"index.php?ignoreupgradewarning=1\">!!!</a>).", 10);
 
 /// set install/upgrade autocontinue session flag
     if ($autopilot) {
     $documentationlink = '<a href="http://docs.moodle.org/en/Installation">Installation docs</a>';
 
     if (ini_get_bool('session.auto_start')) {
-        print_error('phpvaroff', 'debug', '', array('session.auto_start', $documentationlink));
+        print_error('phpvaroff', 'debug', '', (object)array('name'=>'session.auto_start', 'link'=>$documentationlink));
     }
 
     if (ini_get_bool('magic_quotes_runtime')) {
-        print_error('phpvaroff', 'debug', '', array('magic_quotes_runtime', $documentationlink));
+        print_error('phpvaroff', 'debug', '', (object)array('name'=>'magic_quotes_runtime', 'link'=>$documentationlink));
     }
 
     if (!ini_get_bool('file_uploads')) {
-        print_error('phpvaron', 'debug', '', array('file_uploads', $documentationlink));
+        print_error('phpvaron', 'debug', '', (object)array('name'=>'file_uploads', 'link'=>$documentationlink));
     }
 
 /// Check that config.php has been edited
@@ -71,7 +61,7 @@
 
     $dirroot = dirname(realpath("../index.php"));
     if (!empty($dirroot) and $dirroot != $CFG->dirroot) {
-        print_error('fixsetting', 'debug', '', array($CFG->dirroot, $dirroot));
+        print_error('fixsetting', 'debug', '', (object)array('current'=>$CFG->dirroot, 'found'=>$dirroot));
     }
 
 /// Set some necessary variables during set-up to avoid PHP warnings later on this page
@@ -85,9 +75,9 @@
         $CFG->version = "";
     }
 
-    if (is_readable("$CFG->dirroot/version.php")) {
-        include_once("$CFG->dirroot/version.php");              // defines $version
-    }
+    $version = null;
+    $release = null;
+    include("$CFG->dirroot/version.php");       // defines $version and $release
 
     if (!$version or !$release) {
         print_error('withoutversion', 'debug'); // without version, stop
@@ -99,9 +89,7 @@
 
     } else {                                 // Check for missing main tables
         $maintables = true;
-        $mtables = array("config", "course", "course_categories", "course_modules",
-                         "course_sections", "log", "log_display", "modules",
-                         "user");
+        $mtables = array('config', 'course', 'groupings'); // some tables used in 1.9 and 2.0, preferable something from the start and end of install.xml 
         foreach ($mtables as $mtable) {
             if (!in_array($mtable, $tables)) {
                 $maintables = false;
             }
         }
     }
+    unset($mtables);
+    unset($tables);
 
-    if (! $maintables) {
+    if (!$maintables) {
     /// hide errors from headers in case debug enabled in config.php
         $origdebug = $CFG->debug;
         $CFG->debug = DEBUG_MINIMAL;
         upgrade_log_start();
         $DB->set_debug(true);
 
-    /// Both old .sql files and new install.xml are supported
-    /// But we prioritise install.xml (XMLDB) if present
-
         if (!$DB->setup_is_unicodedb()) {
             if (!$DB->change_db_encoding()) {
                 // If could not convert successfully, throw error, and prevent installation
             }
         }
 
-        $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); //New method
-
-        // all new installs are in unicode - keep for backwards compatibility and 1.8 upgrade checks
-        set_config('unicodedb', 1);
+        $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
 
     /// Continue with the instalation
-        $DB->set_debug(false);
-
-        /// Groups install is now in core above.
 
         // Install the roles system.
         moodle_install_roles();
         events_update_definition();
 
         // Install core message providers
-        require_once($CFG->libdir .'/messagelib.php');      // Messagelib functions
         message_update_providers();
 
         /// This is used to handle any settings that must exist in $CFG but which do not exist in
         // (this should only have any effect during initial install).
         admin_apply_default_settings(NULL, true);
 
-        notify($strdatabasesuccess, "green");
+        // store main version
+        if (!set_config('version', $version)) {
+            print_error('cannotupdateversion', 'debug');
+        }
+
+        notify($strdatabasesuccess, 'notifysuccess');
+
+        /// do not show certificates in log ;-) 
+        $DB->set_debug(false);
+
+        // hack - set up mnet
         require_once $CFG->dirroot.'/mnet/lib.php';
 
         print_continue('index.php');
         print_footer('none');
+
         die;
     }
 
 
 /// Check version of Moodle code on disk compared with database
 /// and upgrade if possible.
-    require_once("$CFG->dirroot/lib/db/upgrade.php");  # defines new upgrades
 
-    $stradministration = get_string("administration");
+    $stradministration = get_string('administration');
 
-    if ($CFG->version) {
-        if ($version > $CFG->version) {  // upgrade
+    if (empty($CFG->version)) {
+        print_error('missingconfigversion', 'debug');
+    }
 
-        /// If the database is not already Unicode then we do not allow upgrading!
-        /// Instead, we print an error telling them to upgrade to 1.7 first.  MDL-6857
-            if (empty($CFG->unicodedb)) {
-                print_error('unicodeupgradeerror', 'error', '', $version);
-            }
+    if ($version > $CFG->version) {  // upgrade
 
-            $a->oldversion = "$CFG->release ($CFG->version)";
-            $a->newversion = "$release ($version)";
-            $strdatabasechecking = get_string("databasechecking", "", $a);
+        require_once($CFG->libdir.'/db/upgrade.php'); // Defines upgrades
+        require_once($CFG->libdir.'/db/upgradelib.php');   // Upgrade-related functions
 
-            // hide errors from headers in case debug is enabled
-            $origdebug = $CFG->debug;
-            $CFG->debug = DEBUG_MINIMAL;
-            error_reporting($CFG->debug);
+        $a->oldversion = "$CFG->release ($CFG->version)";
+        $a->newversion = "$release ($version)";
+        $strdatabasechecking = get_string("databasechecking", "", $a);
 
-            // logo ut in case we are upgrading from pre 1.9 version in order to prevent
-            // weird session/role problems caused by incorrect data in USER and SESSION
-            if ($CFG->version < 2007101500) {
-                require_logout();
-            }
+        // hide errors from headers in case debug is enabled
+        $origdebug = $CFG->debug;
+        $CFG->debug = DEBUG_MINIMAL;
+        error_reporting($CFG->debug);
 
-            if (empty($confirmupgrade)) {
-                $navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
-                print_header($strdatabasechecking, $stradministration, $navigation,
-                        "", "", false, "&nbsp;", "&nbsp;");
+        // logo ut in case we are upgrading from pre 1.9 version in order to prevent
+        // weird session/role problems caused by incorrect data in USER and SESSION
+        if ($CFG->version < 2007101500) {
+            require_logout();
+        }
 
-                notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
-                print_footer('none');
-                exit;
-
-            } else if (empty($confirmrelease)){
-                $strcurrentrelease = get_string("currentrelease");
-                $navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
-                print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, "&nbsp;", "&nbsp;");
-                print_heading("Moodle $release");
-                print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
-
-                require_once($CFG->libdir.'/environmentlib.php');
-                print_heading(get_string('environment', 'admin'));
-                if (!check_moodle_environment($release, $environment_results, true)) {
-                    print_box_start('generalbox', 'notice'); // MDL-8330
-                    print_string('langpackwillbeupdated', 'admin');
-                    print_box_end();
-                    notice_yesno(get_string('environmenterrorupgrade', 'admin'),
-                                 'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
-                } else {
-                    notify(get_string('environmentok', 'admin'), 'notifysuccess');
-                    print_box_start('generalbox', 'notice'); // MDL-8330
-                    print_string('langpackwillbeupdated', 'admin');
-                    print_box_end();
-                    echo '<form action="index.php"><div>';
-                    echo '<input type="hidden" name="confirmupgrade" value="1" />';
-                    echo '<input type="hidden" name="confirmrelease" value="1" />';
-                    echo '</div>';
-                    echo '<div class="continuebutton">';
-                    echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
-                    echo '</form>';
-                }
+        if (empty($confirmupgrade)) {
+            $navigation = build_navigation(array(array('name'=>$strdatabasechecking, 'link'=>null, 'type'=>'misc')));
+            print_header($strdatabasechecking, $stradministration, $navigation,
+                    "", "", false, "&nbsp;", "&nbsp;");
 
-                print_footer('none');
-                die;
-            } elseif (empty($confirmplugincheck)) {
-                $strplugincheck = get_string('plugincheck');
-                $navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
-                print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, "&nbsp;", "&nbsp;");
-                print_heading($strplugincheck);
+            notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=1', 'index.php');
+            print_footer('none');
+            exit;
+
+        } else if (empty($confirmrelease)){
+            $strcurrentrelease = get_string("currentrelease");
+            $navigation = build_navigation(array(array('name'=>$strcurrentrelease, 'link'=>null, 'type'=>'misc')));
+            print_header($strcurrentrelease, $strcurrentrelease, $navigation, "", "", false, "&nbsp;", "&nbsp;");
+            print_heading("Moodle $release");
+            print_box(get_string('releasenoteslink', 'admin', 'http://docs.moodle.org/en/Release_Notes'));
+
+            require_once($CFG->libdir.'/environmentlib.php');
+            print_heading(get_string('environment', 'admin'));
+            if (!check_moodle_environment($release, $environment_results, true)) {
                 print_box_start('generalbox', 'notice'); // MDL-8330
-                print_string('pluginchecknotice');
+                print_string('langpackwillbeupdated', 'admin');
+                print_box_end();
+                notice_yesno(get_string('environmenterrorupgrade', 'admin'),
+                             'index.php?confirmupgrade=1&confirmrelease=1', 'index.php');
+            } else {
+                notify(get_string('environmentok', 'admin'), 'notifysuccess');
+                print_box_start('generalbox', 'notice'); // MDL-8330
+                print_string('langpackwillbeupdated', 'admin');
                 print_box_end();
-                print_plugin_tables();
-                echo "<br />";
-                echo '<div class="continuebutton">';
-                print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
-                echo '</div><br />';
                 echo '<form action="index.php"><div>';
                 echo '<input type="hidden" name="confirmupgrade" value="1" />';
                 echo '<input type="hidden" name="confirmrelease" value="1" />';
-                echo '<input type="hidden" name="confirmplugincheck" value="1" />';
                 echo '</div>';
-                echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
+                echo '<div class="continuebutton">';
                 echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
                 echo '</form>';
-                print_footer('none');
-                die();
+            }
 
-            } else {
-                $strdatabasesuccess  = get_string("databasesuccess");
-                $navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
-                print_header($strdatabasechecking, $stradministration, $navigation,
-                        "", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
+            print_footer('none');
+            die;
+        } elseif (empty($confirmplugins)) {
+            $strplugincheck = get_string('plugincheck');
+            $navigation = build_navigation(array(array('name'=>$strplugincheck, 'link'=>null, 'type'=>'misc')));
+            print_header($strplugincheck, $strplugincheck, $navigation, "", "", false, "&nbsp;", "&nbsp;");
+            print_heading($strplugincheck);
+            print_box_start('generalbox', 'notice'); // MDL-8330
+            print_string('pluginchecknotice');
+            print_box_end();
+            print_plugin_tables();
+            echo "<br />";
+            echo '<div class="continuebutton">';
+            print_single_button('index.php', array('confirmupgrade' => 1, 'confirmrelease' => 1), get_string('reload'), 'get');
+            echo '</div><br />';
+            echo '<form action="index.php"><div>';
+            echo '<input type="hidden" name="confirmupgrade" value="1" />';
+            echo '<input type="hidden" name="confirmrelease" value="1" />';
+            echo '<input type="hidden" name="confirmplugincheck" value="1" />';
+            echo '</div>';
+            echo '<div class="continuebutton"><input name="autopilot" id="autopilot" type="checkbox" value="1" /><label for="autopilot">'.get_string('unattendedoperation', 'admin').'</label>';
+            echo '<br /><br /><input type="submit" value="'.get_string('continue').'" /></div>';
+            echo '</form>';
+            print_footer('none');
+            die();
 
-            /// return to original debugging level
-                $CFG->debug = $origdebug;
-                error_reporting($CFG->debug);
-                upgrade_log_start();
+        } else {
 
-            /// Upgrade current language pack if we can
-                upgrade_language_pack();
+            $strdatabasesuccess  = get_string("databasesuccess");
+            $navigation = build_navigation(array(array('name'=>$strdatabasesuccess, 'link'=>null, 'type'=>'misc')));
+            print_header($strdatabasechecking, $stradministration, $navigation,
+                    "", upgrade_get_javascript(), false, "&nbsp;", "&nbsp;");
 
-                print_heading($strdatabasechecking);
-                $DB->set_debug(true);
-            /// Launch the old main upgrade (if exists)
-                $status = true;
-                if (function_exists('main_upgrade')) {
-                    $status = main_upgrade($CFG->version);
-                }
-            /// If succesful and exists launch the new main upgrade (XMLDB), called xmldb_main_upgrade
-                if ($status && function_exists('xmldb_main_upgrade')) {
-                    $status = xmldb_main_upgrade($CFG->version);
+        /// return to original debugging level
+            $CFG->debug = $origdebug;
+            error_reporting($CFG->debug);
+            upgrade_log_start();
+
+        /// Upgrade current language pack if we can
+            upgrade_language_pack();
+
+            print_heading($strdatabasechecking);
+            $DB->set_debug(true);
+        /// Launch the old main upgrade (if exists)
+            $status = true;
+            if (function_exists('main_upgrade')) {
+                $status = main_upgrade($CFG->version);
+            }
+        /// If succesful and exists launch the new main upgrade (XMLDB), called xmldb_main_upgrade
+            if ($status && function_exists('xmldb_main_upgrade')) {
+                $status = xmldb_main_upgrade($CFG->version);
+            }
+            $DB->set_debug(false);
+        /// If successful, continue upgrading roles and setting everything properly
+            if ($status) {
+                if (!update_capabilities()) {
+                    print_error('cannotupgradecapabilities', 'debug');
                 }
-                $DB->set_debug(false);
-            /// If successful, continue upgrading roles and setting everything properly
-                if ($status) {
-                    if (!update_capabilities()) {
-                        print_error('cannotupgradecapabilities', 'debug');
-                    }
-
-                    // Update core events
-                    events_update_definition();
-
-                    // Update core message providers
-                    require_once($CFG->libdir .'/messagelib.php');      // Messagelib functions
-                    message_update_providers();
-
-                    if (set_config("version", $version)) {
-                        remove_dir($CFG->dataroot . '/cache', true); // flush cache
-                        notify($strdatabasesuccess, "green");
-                        print_continue("upgradesettings.php");
-                        print_footer('none');
-                        exit;
-                    } else {
-                        print_error('cannotupdateversion', 'debug');
-                    }
-            /// Main upgrade not success
-                } else {
-                    notify('Main Upgrade failed!  See lib/db/upgrade.php');
-                    print_continue('index.php?confirmupgrade=1&amp;confirmrelease=1&amp;confirmplugincheck=1');
+
+                // Update core events
+                events_update_definition();
+
+                // Update core message providers
+                message_update_providers();
+
+                if (set_config("version", $version)) {
+                    remove_dir($CFG->dataroot . '/cache', true); // flush cache
+                    notify($strdatabasesuccess, "green");
+                    print_continue("upgradesettings.php");
                     print_footer('none');
-                    die;
+                    exit;
+                } else {
+                    print_error('cannotupdateversion', 'debug');
                 }
-                upgrade_log_finish();
+        /// Main upgrade not success
+            } else {
+                notify('Main Upgrade failed!  See lib/db/upgrade.php');
+                print_continue('index.php?confirmupgrade=1&amp;confirmrelease=1&amp;confirmplugincheck=1');
+                print_footer('none');
+                die;
             }
-        } else if ($version < $CFG->version) {
-            upgrade_log_start();
-            notify("WARNING!!!  The code you are using is OLDER than the version that made these databases!");
             upgrade_log_finish();
         }
-    } else {
-        if (!set_config("version", $version)) {
-            print_error('cannotupdateversion', 'debug');
-        }
+    } else if ($version < $CFG->version) {
+        upgrade_log_start();
+        notify("WARNING!!!  The code you are using is OLDER than the version that made these databases!");
+        upgrade_log_finish();
     }
 
 /// Updated human-readable release version if necessary
         }
     }
 
-/// Groups install/upgrade is now in core above.
-
-
 /// Find and check all main modules and load them up or upgrade them if necessary
 /// first old *.php update and then the new upgrade.php script
     upgrade_activity_modules("$CFG->wwwroot/$CFG->admin/index.php");  // Return here afterwards
index d7b7c7f2fdac88f241ffed5ed4fe07b231da4af9..724b93d56ee2119cde4be36620c3c7df0e76e021 100644 (file)
             if ($location || $plugin) {
                 // file in an extra location
                 if ($currentfile != "{$prefix}{$plugin}.php") {
-                    print_error('filemismatch', 'error', '', array($currectfile, $prefix, $plugin));
+                    print_error('filemismatch', 'error', '', (object)array('current'=>$currectfile, 'file'=>$prefix.$plugin.'.php'));
                 }
                 if (!$uselocal) {
                     notify($streditingnoncorelangfile);
             } else {
                 // file in standard location
                 if ($currentfile != $filename) {
-                    print_error('filemismatch', 'error', '', array($currectfile, $filename, ''));
+                    print_error('filemismatch', 'error', '', (object)array('current'=>$currectfile, 'file'=>$filename.'.php'));
                 }
             }
 
             if (lang_save_file($saveinto, $currentfile, $newstrings, $uselocal, $packstring)) {
                 notify(get_string("changessaved")." ($saveinto/$currentfile)", "notifysuccess");
             } else {
-                print_error('cannotsavefile', 'error', 'lang.php?mode=compare&amp;currentfile=$currentfile', array($saveinto, $currentfile));
+                print_error('cannotsavefile', 'error', 'lang.php?mode=compare&amp;currentfile=$currentfile', $saveinto.'/'.$currentfile);
             }
             unset($packstring);
         }
index 67583c5b2e4cf3c79633bdcc0586ded4403102e4..ec9ac0b33f0bb740496d09f74dc447792102a5a3 100644 (file)
@@ -15,8 +15,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
 
     // Completion system
     require_once($CFG->libdir.'/completionlib.php');
-    $temp->add(new admin_setting_configcheckbox('enablecompletion',get_string('enablecompletion','completion'),get_string('configenablecompletion','completion'),COMPLETION_DISABLED));
-    $temp->add(new admin_setting_pickroles('progresstrackedroles',get_string('progresstrackedroles','completion'),get_string('configprogresstrackedroles','completion')));
+    $temp->add(new admin_setting_configcheckbox('enablecompletion', get_string('enablecompletion','completion'), get_string('configenablecompletion','completion'), COMPLETION_DISABLED));
+    $temp->add(new admin_setting_pickroles('progresstrackedroles', get_string('progresstrackedroles','completion'), get_string('configprogresstrackedroles', 'completion'), array('moodle/legacy:student')));
 
     $ADMIN->add('misc', $temp);
 
index de6597c6f40782a40ada4e0c120780b9b8f43f64..e75c1266ff9d353c05f51a571eeef1b7529bda5a 100644 (file)
 //
 // 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=0) {
-
-    global $CFG, $THEME, $DB;
+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 
index 9cd056bdae63f942ebea756b416169ce381c5ec1..502e7a0c1ba090378806eace61f49a578223930a 100644 (file)
 //
 // 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_block_activity_modules_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_activity_modules_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index fc6ef1403d071c44f695d0ea4b1ba9fbbef9ba8b..bb2282e65e73a2dd18105f6f92112040f4cec12d 100644 (file)
 //
 // 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_block_admin_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_admin_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index ba3745b09e8f8f486ae99f3751533c223ff5bf63..88eb8c18038388504a0fa27fbfd1126975f39aa5 100644 (file)
 //
 // 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_block_calendar_month_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_calendar_month_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 1ee5c024f3ad8f231dd28a8bc2ab3cfaadd6a5d2..c55e79114fd75cba449326d3b2e7371cbb1060e8 100644 (file)
 //
 // 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_block_calendar_upcoming_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_calendar_upcoming_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index fb46ad1b6e47130db183ea7f28fe93b5ecca2875..b25621016e859c4fe539737775f7b6dc45297286 100644 (file)
 //
 // 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_block_course_list_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_course_list_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 28f823ce7c91de0643f4a7b75a7c2f0ae3976b3d..674d56391cbedfb365b02d55c726ebd5e63a45e4 100644 (file)
 //
 // 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_block_course_summary_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_course_summary_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 784808bb437889a1daebb79ea8d94624c27ba86a..467e0124fa18cd4ce021ab681aebfbb54076b530 100644 (file)
 //
 // 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_blocks_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_blocks_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager();
-
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index bd9b97562b3b613180f1f38921ceea394750629d..8f2c5100caa427e1c7057826ef307135852c3fe5 100644 (file)
 //
 // 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_block_news_items_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_news_items_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 334c81f696228fac12bea1f8f080ad9ce9ad7dd5..501ff24fe3140d7cdc8bf4a3defd243035e05d2a 100644 (file)
 //
 // 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_block_online_users_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_online_users_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 9decca3880121b50c02b8a79e00513409ba01daf..98b03be8a159fcdc750b049b5d38f3b4608ddaf3 100644 (file)
 //
 // 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_block_participants_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_participants_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 65082fd96293c45fba992d8318ff43cc834ef298..d08f065aa0e4089fe6c1041891fbdf883efe1a6c 100644 (file)
 //
 // 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_block_recent_activity_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_recent_activity_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index c8261d020cbf1a6fa9d36d516a7512653c4cfb2a..282f08e422762a4d0eb5fb95595588f910a57646 100644 (file)
 //
 // 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_block_rss_client_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_rss_client_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 6e742dbd05abeb9d0a2f06a42b9dd68ce0ccc412..40575942bd92110dc668c37131c1337a211d657b 100644 (file)
@@ -107,12 +107,11 @@ $defaultfiletypes = "PDF,TXT,HTML,PPT,XML,DOC,HTM";
             if(isset($CFG->block_search_pdf_to_text_cmd)) {
                 p($CFG->block_search_pdf_to_text_cmd);
             } else {
-                $encoding = ($CFG->unicodedb) ? "-enc UTF-8" : "-enc ISO-8859-1" ;
                 if ($CFG->ostype == 'WINDOWS'){
-                    p("lib/xpdf/win32/pdftotext.exe -eol dos $encoding -q");
+                    p("lib/xpdf/win32/pdftotext.exe -eol dos -enc UTF-8 -q");
                 }
                 else{
-                    p("lib/xpdf/linux/pdftotext $encoding -eol unix -q");
+                    p("lib/xpdf/linux/pdftotext -enc UTF-8 -eol unix -q");
                 }
             } ?>"/><br/><br/>
         </td>
index 80ce4c4b5a5899dda8a12cdad42ca258397f343e..78089ee4d88f845ffd1e8954e387ee47c36a15c8 100644 (file)
 //
 // 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_block_search_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_search_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 99ae3c9ae85a18ad353946c283f65fab3d4ec151..19579a98de88139c99f089231665febca1bf8ed9 100644 (file)
 //
 // 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_block_search_forums_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_search_forums_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 2e1c6dfab744b6105b3cd35c52e49a408632f913..69475c56e800918f9296fe3b1ba043e960104026 100644 (file)
 //
 // 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_block_section_links_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_section_links_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 914bd22ca9595dec9d2093de80a6986405d0e4aa..e5b70b051ce4d5b98a7144f25b5336a4edd72d40 100644 (file)
 //
 // 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_block_social_activities_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_block_social_activities_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index efc3a9b5d1f73ccb173846b5ff50fe87dd81c6cf..e8fecdb5eeb79e66a224e9cf96b363c97cd0f72e 100644 (file)
@@ -69,7 +69,7 @@ visit the admin page.
   
   The function must look like:
   
-  function xmldb_format_yourformat_upgrade($oldversion=0) { 
+  function xmldb_format_yourformat_upgrade($oldversion) { 
   ...
   
 * yourformat/version.php
index 37034a2ffaea8fd452db2f80328ece297b35f341..7bbf8cc9aa7147ade125a4e32e196c9d6c6d1770 100644 (file)
 //
 // 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_enrol_authorize_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_enrol_authorize_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
index 7c39348e9a011be8f7d87fc38181d2bf8f9def95..8a0aa93eb3071956dd8f3695499f00140ed74d79 100644 (file)
 //
 // 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_enrol_paypal_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_enrol_paypal_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 2ddd315a80254edd10a02f3b60122d1c509a2d07..b84154094130152129a2a55ce4ccf8d4eafd125a 100644 (file)
@@ -733,6 +733,7 @@ $string['upgradesure'] = 'Your Moodle files have been changed, and you are about
 Once you do this you can not go back again. <br /><br />
 Please note that this process can take a long time. <br /><br />
 Are you sure you want to upgrade this server to this version?';
+$string['upgradetimedout'] = 'Upgrade timed out, please restart the upgrade.';
 $string['upgradingdata'] = 'Upgrading data';
 $string['upgradinglogs'] = 'Upgrading logs';
 $string['uploaduserspreview'] = 'Upload users preview';
index 5fac4e6ad99ea3d959992f9befd05138ed6173f3..4d7476faf5e4a369a3923830d5717b701cca967b 100644 (file)
@@ -29,9 +29,7 @@ $string['cannotaccesspresentsother'] = 'You are not allowed to access presets fr
 $string['cannotadd'] = 'Can not add entries!';
 $string['cannotdeletepreset'] = 'Error deleting a preset!';
 $string['cannotrate'] = 'Rating of items not allowed!';
-$string['cannotupdaterate'] = 'Could not update an old rating ($a[0] = $a[1])';
 $string['cannotunziptopreset'] = 'Cannot unzip to the preset directory';
-$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
 $string['cannotinsertempty'] = 'Could not make an empty record!';
 $string['cancel'] = 'Cancel';
 $string['checkbox'] = 'Checkbox';
index 365bcba1c411ffd90e83fac2506b407199eec856..c28513a0442ecb5a2e35c5105008aaed59978ae3 100644 (file)
@@ -3,10 +3,11 @@
  * debug information for developer only
  */
 $string['authpluginnotfound'] = 'Authentication plugin $a not found.';
+$string['blocknotexist'] = '$a block doesn\'t exist';
 $string['cannotbenull'] = '$a cannot be null!';
 $string['cannotcreateadminuser'] = 'SERIOUS ERROR: Could not create admin user record !!!';
-$string['cannotdowngrade'] = 'Cannot downgrade from $a[0] to $a[1].';
-$string['cannotinitpage'] = 'Cannot fully initialize page: invalid $a[0] id $a[1]';
+$string['cannotdowngrade'] = 'Cannot downgrade from $a->oldversion to $a->newversion.';
+$string['cannotinitpage'] = 'Cannot fully initialize page: invalid $a->name id $a->id';
 $string['cannotupgradecapabilities'] = 'Had trouble upgrading the core capabilities for the Roles System';
 $string['cannotupdateversion'] = 'Upgrade failed!  (Could not update version in config table)';
 $string['cannotupdaterelease'] = 'ERROR: Could not update release version in database!!';
@@ -21,9 +22,10 @@ $string['dbnotsupport'] = 'Error: Your database ($a) is not yet fully supported
 $string['dbnotsetup'] = 'Error: Main databases NOT set up successfully';
 $string['doesnotworkwitholdversion'] = 'This script does not work with this old version of Moodle';
 $string['erroroccur'] = 'An error has occurred during this process';
-$string['fixsetting'] = 'Please fix your settings in config.php: <p>You have:</p> <p>\$CFG->dirroot = \"$a[0]\";</p> <p>but it should be:</p> <p>\$CFG->dirroot = \"$a[1]\"</p>';
+$string['fixsetting'] = 'Please fix your settings in config.php: <p>You have:</p> <p>\$CFG->dirroot = \"$a->current\";</p> <p>but it should be:</p> <p>\$CFG->dirroot = \"$a->found\"</p>';
 $string['invalideventdata'] = 'Incorrect eventadata submitted: $a';
 $string['invalidarraysize'] = 'Incorrect size of arrays in params of $a';
+$string['missingconfigversion'] = 'Config table does not contain version, can not continue, sorry.';
 $string['mustbeoveride'] = 'Abstract $a method must be overriden.';
 $string['morethanonerecordinfetch'] = 'Found more than one record in fetch() !';
 $string['noadminrole'] = 'No admin role could be found';
@@ -37,16 +39,13 @@ $string['nopageclass'] = 'Imported $a but found no page classes';
 $string['noreports'] = 'No reports accessible';
 $string['nomodules'] = 'No modules found!!';
 $string['modulenotexist'] = '$a module doesn\'t exist';
-$string['phpvaroff'] = 'The PHP server variable \'$a[0]\' should be Off - $a[1]';
-$string['phpvaron'] = 'The PHP server variable \'$a[0]\' is not turned On - $a[1]';
-$string['prefixcannotbeempty'] = 'Table prefix \"$a[0]\" cannot be empty for your target DB ($a[1])'; // obsoleted 2.0
-$string['prefixlimit'] = 'Table prefix \"$a\" maximum allowed length for Oracle DBs is 2cc.'; // obsoleted in 2.0
-$string['withoutversion'] = 'Main version.php was not readable or specified';
+$string['phpvaroff'] = 'The PHP server variable \'$a->name\' should be Off - $a->link';
+$string['phpvaron'] = 'The PHP server variable \'$a->name\' is not turned On - $a->link';
 $string['sessionmissing'] = '$a object missing from session';
 $string['siteisnotdefined'] = 'Site is not defined!';
 $string['sqlrelyonobsoletetable'] = 'This SQL relies on obsolete table(s): $a!  Your code must be fixed by a developer.';
 $string['upgradefail'] = 'Upgrade failed! see: $a';
-$string['withoutversion'] = 'Main version.php was not readable or specified';
+$string['withoutversion'] = 'Main version.php file is missing, not readable or broken.';
 $string['xmlizeunavailable'] = 'xmlize functions are not available';
 
 ?>
index 828347917d6324caa23f2efd3f00d63c51d93216..0683e58772c67daf35b2798169f5d00d08bf2b38 100644 (file)
@@ -8,10 +8,10 @@ $string['blockdoesnotexist'] = 'This block does not exist';
 $string['blockcannotinistantiate'] = 'Problem in instantiating block object';
 $string['blockcannotread'] = 'Could not read data for blockid= $a ';
 $string['blockcannotconfig'] = 'This block does not support global configuration';
-$string['blocknameconflict'] = 'Naming conflict: block $a[0] has the same title with an existing block: $a[1]!';
+$string['blocknameconflict'] = 'Naming conflict: block $a->name has the same title with an existing block: $a->conflict!';
 $string['backupcontainexternal'] = 'This backup file contains external Moodle Network Hosts that are not configured locally';
 $string['backuptablefail'] = 'Backup tables could NOT be set up successfully!';
-$string['boundsyntaxnotsupport'] = 'Pg $1, $2 bound syntax not supported yet :-(';
+$string['boundsyntaxnotsupport'] = 'Pg \$1, \$2 bound syntax not supported yet :-(';
 $string['cannotassignanthing'] = 'Cannot assign moodle/site:doanything';
 $string['cannotassignrole'] = 'Cannot assign role in course';
 $string['cannotassignselfasparent'] = 'Cannot assign self as parent!';
@@ -23,9 +23,9 @@ $string['cannotaddrss'] = 'You do not have permission to add rss feeds';
 $string['cannotaddmodule'] = '$a module could not be added to the module list!';
 $string['cannotaddnewmodule'] = 'Could not add a new module of $a';
 $string['cannotaddnewinstance'] = 'Could not add a new instance of $a';
-$string['cannotsaveconfig'] = 'Problem saving config \"$a[0]\" as \"$a[1]\" for plugin \"$a[2]\"';
+$string['cannotsaveconfig'] = 'Problem saving config \"$a->name\" as \"$a=>value\" for plugin \"$a->plugin\"';
 $string['cannotsavecomment'] = 'Cannot save comment';
-$string['cannotsavefile'] = 'Cannot save the file\"$a[0]\/$a[1]\"!';
+$string['cannotsavefile'] = 'Cannot save the file \"$a\"!';
 $string['cannotsavedata'] = 'Cannot save data';
 $string['cannotsaveagreement'] = 'Could not save your agreement';
 $string['cannotcallscript'] = 'You cannot call this script in that way';
@@ -103,12 +103,11 @@ $string['cannotresetguestpwd'] = 'You cannot reset the guest password';
 $string['cannotresetmail'] = 'Error resetting password and mailing you';
 $string['cannotsaveblock'] = 'Error saving block configuration';
 $string['cannotsavefile'] = 'Cannot save the file \"$a\"';
-$string['cannotinitpage'] = 'Cannot quickly initialize page, course id: $a';
 $string['cannotinsertcategory'] = 'Weird error. The category was not inserted.';
 $string['cannotinsertcomment'] = 'Could not insert this new comment';
 $string['cannotinsertgrade'] = 'Cannot insert grade item without course id!';
 $string['cannotinsertrecord'] = 'Could not insert new record ID $a';
-$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
+$string['cannotinsertrate'] = 'Could not insert a new rating ($a->id = $a->rating)';
 $string['cannotinsertkey'] = 'Cannot insert new key';
 $string['cannotsavecomment'] = 'Error while saving comment';
 $string['cannotsavemd5file'] = 'Cannot save md5 file';
@@ -133,6 +132,7 @@ $string['cannotupdatecm'] = 'Could not update the course module with the correct
 $string['cannotupdatefield'] = 'Error updating field';
 $string['cannotupdatelevel'] = 'Could not update the indent level on that course module';
 $string['cannotupdategroup'] = 'Error updating group';
+$string['cannotupdaterate'] = 'Could not update an old rating ($a->id = $a->rating)';
 $string['cannotupdaterecord'] = 'Could not update record ID $a';
 $string['cannotupdaterole'] = 'Cannot update role!';
 $string['cannotupdatemod'] = 'Could not update $a';
@@ -152,7 +152,7 @@ $string['cannotuploadfile'] = 'Error processing upload file';
 $string['cannotuseadmin'] = 'You need to be an admin user to use this page';
 $string['cannotuseadminadminorteacher'] = 'You need to be a teacher or admin user to use this page';
 $string['cannotunassignrolefrom'] = 'Cannot unassign this user from role id: $a';
-$string['cannotunassigncap'] = 'Could not unassign deprecated capability $a[0] from role $a[1]';
+$string['cannotunassigncap'] = 'Could not unassign deprecated capability $a->cap from role $a->role';
 $string['cannotrestoreadminorcreator'] = 'You need to be a creator or admin user to restore into new course!';
 $string['cannotrestoreadminoredit'] = 'You need to be a editing teacher or admin user to restore into selected course!';
 $string['cannotusepage'] = 'Only teachers and administrators can use this page';
@@ -207,7 +207,7 @@ $string['expiredkey'] = 'Expired key';
 $string['failtoloadblocks'] = 'One or more blocks are registered in the database, but they all failed to load!';
 $string['fieldrequired'] = '\"$a\" is a required field';
 $string['filenotfound'] = 'Sorry, the requested file could not be found';
-$string['filemismatch'] = 'Non-core file name mismatch. The file \"$a[0]\" should be {$a[1]}{$a[2]}.php';
+$string['filemismatch'] = 'Non-core file name mismatch. The file \"$a->current\" should be $a->file';
 $string['filternotinstalled'] = 'Filter $a is not currently installed';
 $string['filternotactive'] = 'Filter $a is not currently active';
 $string['forumblockingtoomanyposts'] = 'You have exceeded the posting threshold set for this forum';
@@ -436,6 +436,7 @@ $string['usernotupdatednotexists'] = 'User not updated - does not exist';
 $string['updatersserror'] = 'There was an error trying to update RSS feed with id: $a';
 $string['upgradeversionfail'] = 'Upgrade of backup system failed! (Could not update version in config table.)';
 $string['upgradefail'] = 'Upgrade failed! $a';
+$string['upgraderunning'] = 'Site is being upgraded, please retry later.';
 $string['younotteacher'] = 'You are not a teacher!';
 $string['wrongcall'] = 'This script is called wrongly';
 $string['wrongcontextid'] = 'Context ID was incorrect (cannot find it)';
index bb85d6b9d4d7f64ef2d0ffdfaf82a1ae536fdf88..e3ed99252f61bbc7e00da40f17da5a9cc520a8f2 100644 (file)
@@ -37,8 +37,6 @@ $string['cannotaddsubscriber'] = 'Could not add subscriber with id $a to this fo
 $string['cannotremovesubscriber'] = 'Could not remove subscriber with id $a from this forum!';
 $string['cannotfindorcreateforum'] = 'Could not find or create a main news forum for the site';
 $string['cannotfindfirstpost'] = 'Could not find the first post in this forum';
-$string['cannotupdaterate'] = 'Could not update an old rating ($a[0] = $a[1])';
-$string['cannotinsertrate'] = 'Could not insert a new rating ($a[0] = $a[1])';
 $string['cannottrack'] = 'Could not stop tracking that forum';
 $string['cleanreadtime'] = 'Mark old posts as read hour';
 $string['completiondiscussions'] = 'User must create discussions:';
index 23897aa975feaa35f291c60d066ebb9b7196acd2..bc88fc89ae2659f089869d4127f3c56871da8fb5 100755 (executable)
@@ -3184,7 +3184,7 @@ function capabilities_cleanup($component, $newcapdef=NULL) {
                 if ($roles = get_roles_with_capability($cachedcap->name)) {
                     foreach($roles as $role) {
                         if (!unassign_capability($cachedcap->name, $role->id)) {
-                            print_error('cannotunassigncap', '', '', array($cachedcap->name, $role->name));
+                            print_error('cannotunassigncap', 'error', '', (object)array('cap'=>$cachedcap->name, 'role'=>$role->name));
                         }
                     }
                 }
index 974fabc4dda20a98298abe4d31f1f9069be96970..9c205190dc620424abb482cc1d2a9a48b5c26acd 100644 (file)
@@ -26,20 +26,55 @@ require_once($CFG->libdir.'/xmldb/xmldb_statement.php');
 require_once($CFG->libdir.'/xmlize.php');
 require_once($CFG->libdir .'/messagelib.php');      // Messagelib functions
 
+global $upgradeloghandle, $upgradelogbuffer;
+
+$upgradeloghandle = false;
+$upgradelogbuffer = '';
+
+
+/**
+ * Upgrade savepoint, marks end of each upgrade block.
+ * It stores new main version, resets upgrade timeout
+ * and abort upgrade if user cancels page loading.
+ *
+ * Please do not make large upgrade blocks with lots of operations,
+ * for example when adding tables keep only one table operation per block.
+ *
+ * @param bool $result false if upgrade step failed, true if completed
+ * @param string or float $version main version
+ * @return void
+ */
 function upgrade_main_savepoint($result, $version) {
     global $CFG;
 
     if ($result) {
         if ($CFG->version >= $version) {
             // something really wrong is going on in main upgrade script
-            print_error('cannotdowngrade', 'debug', '', array($CFG->version, $version));
+            print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$CFG->version, 'newversion'=>$version));
         }
         set_config('version', $version);
     } else {
         notify ("Upgrade savepoint: Error during main upgrade to version $version");
     }
+
+    // reset upgrade timeout to default
+    upgrade_set_timeout();
+
+    // this is a safe place to stop upgrades if user aborts page loading
+    if (connection_aborted()) {
+        die;
+    }
 }
 
+/**
+ * Module upgrade savepoint, marks end of module upgrade blocks
+ * It stores module version, resets upgrade timeout
+ * and abort upgrade if usercancels page loading.
+ *
+ * @param bool $result false if upgrade step failed, true if completed
+ * @param string or float $version main version
+ * @return void
+ */
 function upgrade_mod_savepoint($result, $version, $modname) {
     global $DB;
 
@@ -50,13 +85,48 @@ function upgrade_mod_savepoint($result, $version, $modname) {
     if ($result) {
         if ($module->version >= $version) {
             // something really wrong is going on in upgrade script
-            print_error('cannotdowngrade', 'debug', '', array($module->version, $version));
+            print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$module->version, 'newversion'=>$version));
         }
         $module->verions = $version;
         $DB->update_record('modules', $module);
     } else {
         notify ("Upgrade savepoint: Error during mod upgrade to version $version");
     }
+
+    // reset upgrade timeout to default
+    upgrade_set_timeout();
+
+    // this is a safe place to stop upgrades if user aborts page loading
+    if (connection_aborted()) {
+        die;
+    }
+}
+
+function upgrade_blocks_savepoint($result, $version, $blockname) {
+    global $DB;
+
+    if (!$block = $DB->get_record('block', array('name'=>$blockname))) {
+        print_error('blocknotexist', 'debug', '', $blockname);
+    }
+
+    if ($result) {
+        if ($block->version >= $version) {
+            // something really wrong is going on in upgrade script
+            print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$block->version, 'newversion'=>$version));
+        }
+        $block->verions = $version;
+        $DB->update_record('block', $block);
+    } else {
+        notify ("Upgrade savepoint: Error during mod upgrade to version $version");
+    }
+
+    // reset upgrade timeout to default
+    upgrade_set_timeout();
+
+    // this is a safe place to stop upgrades if user aborts page loading
+    if (connection_aborted()) {
+        die;
+    }
 }
 
 function upgrade_plugin_savepoint($result, $version, $type, $dir) {
@@ -67,10 +137,6 @@ function upgrade_backup_savepoint($result, $version) {
     //TODO
 }
 
-function upgrade_blocks_savepoint($result, $version, $type) {
-    //TODO
-}
-
 /**
  * Delete all plugin tables
  * @name string name of plugin, used as table prefix
@@ -382,7 +448,7 @@ function upgrade_plugins($type, $dir, $return) {
             }
         } else {
             upgrade_log_start();
-            print_error('cannotdowngrade', 'debug', '', array($CFG->pluginversion, $plugin->version));
+            print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$CFG->pluginversion, 'newversion'=>$plugin->version));
         }
     }
 
@@ -390,14 +456,14 @@ function upgrade_plugins($type, $dir, $return) {
 
     if ($updated_plugins && !$embedded) {
         if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-        print_continue($return);
-        print_footer('none');
-        die;
+            print_continue($return);
+            print_footer('none');
+            die;
         } else if (CLI_UPGRADE && ($interactive > CLI_SEMI )) {
             console_write(STDOUT,'askcontinue');
             if (read_boolean()){
                 return ;
-            }else {
+            } else {
                 console_write(STDERR,'','',false);
             }
         }
@@ -517,7 +583,7 @@ function upgrade_activity_modules($return) {
                     remove_dir($CFG->dataroot . '/cache', true); // flush cache
                     notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
                     if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) {
-                    echo '<hr />';
+                       echo '<hr />';
                     }
                 } else {
                     notify('Upgrading '. $module->name .' from '. $currmodule->version .' to '. $module->version .' FAILED!');
@@ -538,16 +604,16 @@ function upgrade_activity_modules($return) {
 
             } else {
                 upgrade_log_start();
-                print_error('cannotdowngrade', 'debug', '', array($currmodule->version, $module->version));
+                print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currmodule->version, 'newversion'=>$module->version));
             }
 
         } else {    // module not installed yet, so install it
             if (!$updated_modules) {
                 if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                print_header($strmodulesetup, $strmodulesetup,
+                    print_header($strmodulesetup, $strmodulesetup,
                         build_navigation(array(array('name' => $strmodulesetup, 'link' => null, 'type' => 'misc'))), '',
                         upgrade_get_javascript(), false, '&nbsp;', '&nbsp;');
-            }
+                }
             }
             upgrade_log_start();
             print_heading($module->name);
@@ -593,7 +659,7 @@ function upgrade_activity_modules($return) {
 
                     notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
                     if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
-                    echo '<hr />';
+                       echo '<hr />';
                     }
                 } else {
                     print_error('cannotaddmodule', '', '', $module->name);
@@ -630,9 +696,9 @@ function upgrade_activity_modules($return) {
 
     if ($updated_modules) {
         if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
-        print_continue($return);
-        print_footer('none');
-        die;
+            print_continue($return);
+            print_footer('none');
+            die;
         } else if ( CLI_UPGRADE && ($interactive > CLI_SEMI) ) {
             console_write(STDOUT,'askcontinue');
             if (read_boolean()){
@@ -794,7 +860,7 @@ function create_admin_user($user_input=NULL) {
         foreach ($adminroles as $adminrole) {
             role_assign($adminrole->id, $user->id, 0, $sitecontext->id);
         }
-        
+
         //set default message preferences
         if (!message_set_default_message_preferences( $user )){
             print_error('cannotsavemessageprefs', 'message');
@@ -808,7 +874,7 @@ function create_admin_user($user_input=NULL) {
         load_all_capabilities();
 
         if (!defined('CLI_UPGRADE')||!CLI_UPGRADE) {
-        redirect("$CFG->wwwroot/user/editadvanced.php?id=$user->id");  // Edit thyself
+          redirect("$CFG->wwwroot/user/editadvanced.php?id=$user->id");  // Edit thyself
         }
     } else {
         print_error('cannotcreateadminuser', 'debug');
@@ -819,30 +885,40 @@ function create_admin_user($user_input=NULL) {
 /// upgrade logging functions
 ////////////////////////////////////////////////
 
-$upgradeloghandle = false;
-$upgradelogbuffer = '';
-// I did not find out how to use static variable in callback function,
-// the problem was that I could not flush the static buffer :-(
-global $upgradeloghandle, $upgradelogbuffer;
-
 /**
- * Check if upgrade is already running.
- *
- * If anything goes wrong due to missing call to upgrade_log_finish()
- * just restart the browser.
- *
- * @param string warning message indicating upgrade is already running
- * @param int page reload timeout
+ * Marks start of upgrade, blocks any other access to site.
+ * The upgrade is finished at the end of script or after timeout.
  */
-function upgrade_check_running($message, $timeout) {
-    global $SESSION;
+function start_upgrade() {
+    global $CFG;
 
-    if (!empty($SESSION->upgraderunning)) {
-        print_header();
-        redirect(me(), $message, $timeout);
+    static $started = false;
+
+    if ($started) {
+        upgrade_set_timeout(120);
+
+    } else {
+        ignore_user_abort(true);
+        register_shutdown_function('upgrade_finished_handler');
+        if ($CFG->version === '') {
+            // db not installed yet
+            $CFG->upgraderunning = time()+300;
+        } else {
+            set_config('upgraderunning', time()+300);
+        }
+        $started = true;
     }
 }
 
+/**
+ * Internal function - executed at the very end of each upgrade.
+ */
+function upgrade_finished_handler() {
+    upgrade_log_finish();
+    unset_config('upgraderunning');
+    ignore_user_abort(false);
+}
+
 /**
  * Start logging of output into file (if not disabled) and
  * prevent aborting and concurrent execution of upgrade script.
@@ -852,25 +928,20 @@ function upgrade_check_running($message, $timeout) {
  * This function may be called repeatedly.
  */
 function upgrade_log_start() {
-    global $CFG, $upgradeloghandle, $SESSION;
+    global $upgradeloghandle;
 
-    if (!empty($SESSION->upgraderunning)) {
-        return; // logging already started
-    }
+    start_upgrade(); // make sure the upgrade is started
 
-    @ignore_user_abort(true);            // ignore if user stops or otherwise aborts page loading
-    $SESSION->upgraderunning = 1;     // set upgrade indicator
-    if (empty($CFG->dbsessions)) {       // workaround for bug in adodb, db session can not be restarted
-        session_write_close();           // from now on user can reload page - will be displayed warning
+    if ($upgradeloghandle and ($upgradeloghandle !== 'error')) {
+        return;
     }
+
     make_upload_directory('upgradelogs');
     ob_start('upgrade_log_callback', 2); // function for logging to disk; flush each line of text ASAP
-    register_shutdown_function('upgrade_log_finish'); // in case somebody forgets to stop logging
 }
 
 /**
- * Terminate logging of output, flush all data, allow script aborting
- * and reopen session for writing. Function print_error() does terminate the logging too.
+ * Terminate logging of output, flush all data.
  *
  * Please make sure that each upgrade_log_start() is properly terminated by
  * this function or print_error().
@@ -878,11 +949,7 @@ function upgrade_log_start() {
  * This function may be called repeatedly.
  */
 function upgrade_log_finish() {
-    global $CFG, $upgradeloghandle, $upgradelogbuffer, $SESSION;
-
-    if (empty($SESSION->upgraderunning)) {
-        return; // logging already terminated
-    }
+    global $CFG, $upgradeloghandle, $upgradelogbuffer;
 
     @ob_end_flush();
     if ($upgradelogbuffer !== '') {
@@ -893,14 +960,6 @@ function upgrade_log_finish() {
         @fclose($upgradeloghandle);
         $upgradeloghandle = false;
     }
-    @session_start();                // ignore header errors, we only need to reopen session
-
-    $SESSION->upgraderunning = 0; // clear upgrade indicator
-
-    if (connection_aborted()) {
-        die;
-    }
-    @ignore_user_abort(false);
 }
 
 /**
@@ -1658,9 +1717,7 @@ class admin_settingpage extends part_of_admin_tree {
                 $data = $adminroot->errors[$fullname]->data;
             } else {
                 $data = $setting->get_setting();
-                if (is_null($data)) {
-                    $data = $setting->get_defaultsetting();
-                }
+                // do not use defaults if settings not available - upgrdesettings handles the defaults!
             }
             $return .= $setting->output_html($data);
         }
@@ -2237,13 +2294,8 @@ class admin_setting_configmulticheckbox extends admin_setting {
             $default = array();
         }
         if (is_null($data)) {
-            foreach ($default as $value) {
-                if ($value) {
-                    $data[] = $value;
-                }
-            }
+            $data = array();
         }
-
         $options = array();
         $defaults = array();
         foreach($this->choices as $key=>$description) {
@@ -3423,9 +3475,9 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
      *   which identify roles that will be enabled by default. Default is the
      *   student role
      */
-    function admin_setting_pickroles($name, $visiblename, $description,$types=array('moodle/legacy:student')) {
+    function admin_setting_pickroles($name, $visiblename, $description, $types) {
         parent::admin_setting_configmulticheckbox($name, $visiblename, $description, NULL, NULL);
-        $this->types=$types;
+        $this->types = $types;
     }
 
     function load_choices() {
@@ -3450,13 +3502,13 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
     function get_defaultsetting() {
         global $CFG;
         if (empty($CFG->rolesactive)) {
-            return array(0);
+            return null;
         }
         $result = array();
         foreach($this->types as $capability) {
             if ($caproles = get_roles_with_capability($capability, CAP_ALLOW)) {
                 foreach ($caproles as $caprole) {
-                    if(!in_array($caprole->id,$result)) {
+                    if (!in_array($caprole->id, $result)) {
                         $result[] = $caprole->id;
                     }
                 }
@@ -3472,7 +3524,8 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
 class admin_setting_special_gradebookroles extends admin_setting_pickroles {
     function admin_setting_special_gradebookroles() {
         parent::admin_setting_pickroles('gradebookroles', get_string('gradebookroles', 'admin'),
-                                                  get_string('configgradebookroles', 'admin'));
+                                                  get_string('configgradebookroles', 'admin'),
+                                                  array('moodle/legacy:student'));
     }
 }
 
@@ -3501,7 +3554,7 @@ class admin_setting_special_coursemanager extends admin_setting_pickroles {
     function admin_setting_special_coursemanager() {
         parent::admin_setting_pickroles('coursemanager', get_string('coursemanager', 'admin'),
                                                   get_string('configcoursemanager', 'admin'),
-                                                  'moodle/legacy:editingteacher');
+                                                  array('moodle/legacy:editingteacher'));
     }
 }
 
@@ -4674,9 +4727,7 @@ function admin_search_settings_html($query) {
                     $data = $adminroot->errors[$fullname]->data;
                 } else {
                     $data = $setting->get_setting();
-                    if (is_null($data)) {
-                        $data = $setting->get_defaultsetting();
-                    }
+                    // do not use defaults if settings not available - upgrdesettings handles the defaults!
                 }
                 $return .= $setting->output_html($data, $query);
             }
@@ -5090,7 +5141,7 @@ class admin_setting_managerepository extends admin_setting {
         parent::admin_setting('managerepository', get_string('managerepository', 'repository'), '', '');
         $this->baseurl = $CFG->wwwroot . '/' . $CFG->admin . '/repository.php?sesskey=' . sesskey();
     }
+
     function get_setting() {
         return true;
     }
index bb33e3ad2e7d49b096c870c5e92205a1cdfca276..9b1b648ca2f8be6dc04c13a8e71b3b504651e68c 100644 (file)
@@ -1326,7 +1326,7 @@ function upgrade_blocks_plugins($continueto) {
                 }
             } else {
                 upgrade_log_start();
-                print_error('cannotdowngrade', 'debug', '', array($currblock->version, $block->version));
+                print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currblock->version, 'newversion'=>$block->version));
             }
 
         } else {    // block not installed yet, so install it
@@ -1345,11 +1345,7 @@ function upgrade_blocks_plugins($continueto) {
             if($conflictblock !== false && $conflictblock !== NULL) {
                 // Duplicate block titles are not allowed, they confuse people
                 // AND PHP's associative arrays ;)
-                if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                    print_error('blocknameconflict', '', '', array($block->name, $conflictblock));
-                } else if (CLI_UPGRADE) {
-                    print_error('blocknameconflict', '', '', array($block->name, $conflictblock));
-                }
+                print_error('blocknameconflict', '', '', (object)array('name'=>$block->name, 'conflict'=>$conflictblock));
             }
             if (empty($updated_blocks)) {
                 $strblocksetup    = get_string('blocksetup');
index 9994486abf32cea087a6635be9e616ad3170b4fd..872e255e19a281d10437e91e036a8084f00d3a6a 100644 (file)
 //
 // 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_main_upgrade($oldversion=0) {
+function xmldb_main_upgrade($oldversion) {
     global $CFG, $THEME, $USER, $DB;
 
     $result = true;
@@ -29,6 +31,7 @@ function xmldb_main_upgrade($oldversion=0) {
     ////////////////////////////////////////
 
     if ($result && $oldversion < 2008030700) {
+        upgrade_set_timeout(60*20); // this may take a while
 
     /// Define index contextid-lowerboundary (not unique) to be dropped form grade_letters
         $table = new xmldb_table('grade_letters');
@@ -61,6 +64,8 @@ function xmldb_main_upgrade($oldversion=0) {
     }
 
     if ($result && $oldversion < 2008050700) {
+        upgrade_set_timeout(60*20); // this may take a while
+
     /// Fix minor problem caused by MDL-5482.
         require_once($CFG->dirroot . '/question/upgrade.php');
         $result = $result && question_fix_random_question_parents();
@@ -85,6 +90,7 @@ function xmldb_main_upgrade($oldversion=0) {
 
     if ($result && $oldversion < 2008051201) {
         notify('Increasing size of user idnumber field, this may take a while...', 'notifysuccess');
+        upgrade_set_timeout(60*20); // this may take a while
 
     /// Under MySQL and Postgres... detect old NULL contents and change them by correct empty string. MDL-14859
         if ($CFG->dbfamily == 'mysql' || $CFG->dbfamily == 'postgres') {
@@ -135,6 +141,8 @@ function xmldb_main_upgrade($oldversion=0) {
     }
 
     if ($result && $oldversion < 2008063001) {
+        upgrade_set_timeout(60*20); // this may take a while
+
         // table to be modified
         $table = new xmldb_table('tag_instance');
         // add field
@@ -262,28 +270,15 @@ function xmldb_main_upgrade($oldversion=0) {
     /// Main savepoint reached
         upgrade_main_savepoint($result, 2008070701);
     }
-    
-    if ($result && $oldversion < 2008072400) {
-        /// Create the database tables for message_processors and message_providers
-        $table = new xmldb_table('message_providers');
-        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
-        $table->add_field('modulename', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
-        $table->add_field('modulefile', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null);
-        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-        $dbman->create_table($table);
 
+    if ($result && $oldversion < 2008072400) {
+    /// Create the database tables for message_processors
         $table = new xmldb_table('message_processors');
         $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
         $table->add_field('name', XMLDB_TYPE_CHAR, '166', null, XMLDB_NOTNULL, null, null, null, null);
         $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
         $dbman->create_table($table);
 
-
-        $provider = new object();
-        $provider->modulename  = 'moodle';
-        $provider->modulefile  = 'index.php';
-        $DB->insert_record('message_providers', $provider);
-
     /// delete old and create new fields
         $table = new xmldb_table('message');
         $field = new xmldb_field('messagetype');
@@ -355,17 +350,17 @@ function xmldb_main_upgrade($oldversion=0) {
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'defaultrole');
 
     /// Launch add field enablecompletion
-        if(!$dbman->field_exists($table,$field)) {
+        if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
-        
+
     /// Define field completion to be added to course_modules
         $table = new xmldb_table('course_modules');
         $field = new xmldb_field('completion');
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'groupmembersonly');
 
     /// Launch add field completion
-        if(!$dbman->field_exists($table,$field)) {
+        if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
 
@@ -374,7 +369,7 @@ function xmldb_main_upgrade($oldversion=0) {
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, null, 'completion');
 
     /// Launch add field completiongradeitemnumber
-        if(!$dbman->field_exists($table,$field)) {
+        if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
 
@@ -383,7 +378,7 @@ function xmldb_main_upgrade($oldversion=0) {
         $field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completiongradeitemnumber');
 
     /// Launch add field completionview
-        if(!$dbman->field_exists($table,$field)) {
+        if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
 
@@ -392,13 +387,13 @@ function xmldb_main_upgrade($oldversion=0) {
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'completionview');
 
     /// Launch add field completionexpected
-        if(!$dbman->field_exists($table,$field)) {
+        if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
 
    /// Define table course_modules_completion to be created
         $table = new xmldb_table('course_modules_completion');
-        if(!$dbman->table_exists($table)) {
+        if (!$dbman->table_exists($table)) {
 
         /// Adding fields to table course_modules_completion
             $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null);
@@ -407,14 +402,14 @@ function xmldb_main_upgrade($oldversion=0) {
             $table->add_field('completionstate', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
             $table->add_field('viewed', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null);
             $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null);
-    
+
         /// Adding keys to table course_modules_completion
             $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
-    
+
         /// Adding indexes to table course_modules_completion
             $table->add_index('coursemoduleid', XMLDB_INDEX_NOTUNIQUE, array('coursemoduleid'));
             $table->add_index('userid', XMLDB_INDEX_NOTUNIQUE, array('userid'));
-    
+
         /// Launch create table for course_modules_completion
             $dbman->create_table($table);
         }
@@ -422,7 +417,7 @@ function xmldb_main_upgrade($oldversion=0) {
         /// Main savepoint reached
         upgrade_main_savepoint($result, 2008072800);
     }
-    
+
     if ($result && $oldversion < 2008073000) {
 
     /// Define table portfolio_log to be created
@@ -602,6 +597,7 @@ function xmldb_main_upgrade($oldversion=0) {
     /// Main savepoint reached
         upgrade_main_savepoint($result, 2008080600);
     }
+
     if ($result && $oldversion < 2008080701) {
 
     /// Define field visible to be added to repository
@@ -667,6 +663,15 @@ function xmldb_main_upgrade($oldversion=0) {
         upgrade_main_savepoint($result, 2008081506);
     }
 
+    if ($result && $oldversion < 2008081600) {
+
+    /// all 1.9 sites and fresh installs must already be unicode, not needed anymore
+        unset_config('unicodedb');
+
+    /// Main savepoint reached
+        upgrade_main_savepoint($result, 2008081600);
+    }
+
     return $result;
 }
 
index cf08fead391e60de42646ed938c4b25c3c5b1961..0c5686c25e71c821c37d7a5ffac6cb4362ce837f 100644 (file)
@@ -73,6 +73,7 @@ function upgrade_migrate_files_courses() {
     $i = 0;
     foreach ($rs as $course) {
         $i++;
+        upgrade_set_timeout(60*5); // set up timeout, may also abort execution
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
         upgrade_migrate_files_course($context, '/', true);
         $pbar->update($i, $count, "Migrated course files - course $i/$count.");
@@ -102,7 +103,7 @@ function upgrade_migrate_files_course($context, $path, $delete) {
         }
 
         if ($item->isLink()) {
-            // do not delete symbolic links or its children 
+            // do not delete symbolic links or its children
             $delete_this = false;
         } else {
             $delete_this = $delete;
@@ -174,6 +175,8 @@ function upgrade_migrate_files_blog() {
 
     if ($rs = $DB->get_recordset_select('post', "module='blog' AND attachment IS NOT NULL AND attachment <> 1")) {
 
+        upgrade_set_timeout(60*20); // set up timeout, may also abort execution
+
         $pbar = new progress_bar('migrateblogfiles', 500, true);
 
         $olddebug = $DB->get_debug();
@@ -183,9 +186,8 @@ function upgrade_migrate_files_blog() {
             $i++;
             $pathname = "$CFG->dataroot/blog/attachments/$entry->id/$entry->attachment";
             if (!file_exists($pathname)) {
-                // hmm, we could set atatchment NULL here, but it would break badly in concurrent ugprades, disabling for now
-                //$entry->attachment = NULL;
-                //$DB->update_record('post', $entry);
+                $entry->attachment = NULL;
+                $DB->update_record('post', $entry);
                 continue;
             }
 
@@ -204,7 +206,7 @@ function upgrade_migrate_files_blog() {
 
             if (!$fs->file_exists(SYSCONTEXTID, 'blog', $entry->id, '/', $filename)) {
                 $file_record = array('contextid'=>SYSCONTEXTID, 'filearea'=>'blog', 'itemid'=>$entry->id, 'filepath'=>'/', 'filename'=>$filename,
-                                     'timecreated'=>filectime($pathname), 'timemodified'=>filemtime($pathname), 'userid'=>$post->userid);
+                                     'timecreated'=>filectime($pathname), 'timemodified'=>filemtime($pathname), 'userid'=>$entry->userid);
                 $fs->create_file_from_pathname($file_record, $pathname);
             }
             @unlink($pathname);
@@ -217,7 +219,7 @@ function upgrade_migrate_files_blog() {
         $DB->set_debug($olddebug); // reset debug level
         $rs->close();
     }
-    
+
     @rmdir("$CFG->dataroot/blog/attachments/");
     @rmdir("$CFG->dataroot/blog/");
 }
index 3d81952eea366fe467860443316dacccf926592e..18063497594a605226710fbfc332e89ee7f209d9 100644 (file)
@@ -2597,7 +2597,7 @@ function fullname($user, $override=false) {
         $CFG->fullnamedisplay = $SESSION->fullnamedisplay;
     }
 
-    if ($CFG->fullnamedisplay == 'firstname lastname') {
+    if (!isset($CFG->fullnamedisplay) or $CFG->fullnamedisplay === 'firstname lastname') {
         return $user->firstname .' '. $user->lastname;
 
     } else if ($CFG->fullnamedisplay == 'lastname firstname') {
@@ -6418,6 +6418,45 @@ function moodle_needs_upgrading() {
     return false;
 }
 
+/**
+ * Sets maximum expected time needed for upgrade task.
+ * Please always make sure that upgrade will not run longer!
+ *
+ * The script may be automatically aborted if upgrade times out.  
+ *
+ * @param int $max_execution_time in seconds (can not be less than 60 s)
+ * @return void
+ */
+function upgrade_set_timeout($max_execution_time=300) {
+    global $CFG;
+
+    if (!isset($CFG->upgraderunning) or $CFG->upgraderunning < time()) {
+        $upgraderunning = get_config(null, 'upgraderunning');
+    } else {
+        $upgraderunning = $CFG->upgraderunning;
+    } 
+    
+    if (!$upgraderunning) {
+        // upgrade not running or aborted
+        print_error('upgradetimedout', 'admin', "$CFG->wwroot/$CFG->admin/");
+        die;
+    }
+
+    if ($max_execution_time < 60) {
+        // protection against 0 here
+        $max_execution_time = 60;
+    }
+
+    $expected_end = time() + $max_execution_time;
+
+    if ($expected_end < $upgraderunning + 10 and $expected_end > $upgraderunning - 10) {
+        // no need to store new end, it is nearly the same ;-)
+        return;
+    }
+
+    set_time_limit($max_execution_time);
+    set_config('upgraderunning', $expected_end); // keep upgrade locked until this time
+}
 
 /// MISCELLANEOUS ////////////////////////////////////////////////////////////////////
 
index 73d0dbe66805986bc1beec88776ea9d58d1bdc29..c1ad669a0e92bd139c3449e88eac5e15328e38fb 100644 (file)
@@ -314,7 +314,7 @@ class page_course extends page_base {
     // Do NOT load up "expensive" resouces (e.g. SQL data) here!
     function init_quick($data) {
         if(empty($data->pageid) && !defined('ADMIN_STICKYBLOCKS')) {
-            print_error('cannotinitpage', '', '', null);
+            print_error('cannotinitpage', 'debug', '', (object)array('name'=>'course', 'id'=>'?'));
         }
         parent::init_quick($data);
     }
@@ -339,7 +339,7 @@ class page_course extends page_base {
         }
 
         if(empty($this->courserecord) && !defined('ADMIN_STICKYBLOCKS')) {
-            print_error('cannotinitpage', '', '', $this->id);
+            print_error('cannotinitpage', 'debug', '', (object)array('name'=>'course', 'id'=>$this->id));
         }
 
         $this->context = get_context_instance(CONTEXT_COURSE, $this->id);
@@ -594,7 +594,7 @@ class page_generic_activity extends page_base {
             print_error('noactivityname', 'debug');
         }
         if (!$this->modulerecord = get_coursemodule_from_instance($this->activityname, $this->id)) {
-            print_error('cannotinitpager', 'debug', '', array($this->activityname, $this->id));
+            print_error('cannotinitpager', 'debug', '', (object)array('name'=>$this->activityname, 'id'=>$this->id));
         }
         $this->courserecord = $DB->get_record('course', array('id'=>$this->modulerecord->course));
         if(empty($this->courserecord)) {
@@ -602,7 +602,7 @@ class page_generic_activity extends page_base {
         }
         $this->activityrecord = $DB->get_record($this->activityname, array('id'=>$this->id));
         if(empty($this->activityrecord)) {
-            print_error('cannotinitpager', 'debug', '', array($this->activityname, $this->id));
+            print_error('cannotinitpager', 'debug', '', (object)array('name'=>$this->activityname, 'id'=>$this->id));
         }
         $this->full_init_done = true;
     }
index 30282a634816c315d0c7e9bc2b17469c31fe9e60..97dc128ad4f4cab1a6ff8c802e8a45b227aa6c3b 100644 (file)
@@ -159,6 +159,15 @@ global $HTTPSPAGEREQUIRED;
 /// Load up any configuration from the config table
     $CFG = get_config();
 
+/// Verify upgrade is not running
+    if (isset($CFG->upgraderunning)) {
+        if ($CFG->upgraderunning < time()) {
+            unset_config('upgraderunning');
+        } else {
+            print_error('upgraderunning');
+        }
+    }
+
 /// Turn on SQL logging if required
     if (!empty($CFG->logsql)) {
         $DB->set_logging(true);
index c6e81b9e448331d902f85b71eabb8557e2b933ea..5cab18a80bbe530821eab9d1b30f66e41bc28e7e 100644 (file)
@@ -5677,7 +5677,7 @@ function print_error($errorcode, $module='', $link='', $a=NULL) {
         $module = 'error';
     }
 
-    if (!isset($CFG->theme)) {
+    if (!isset($CFG->theme) or !isset($CFG->stylesheets)) {
         // error found before setup.php finished
         _print_early_error($errorcode, $module, $a);
     } else {
index 3b8c0da0c55607571198436c3201dbf6387aa109..0191416c5d5abea22d2e367d912075679a33a3dd 100644 (file)
  * @package 
  */
 
-function xmldb_message_email_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_message_email_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
     if ($result && $oldversion < 2008072401) {
index ec1578f74fe606891c9f2e38bd9252e16d33df56..bfb70d836bfa85b8325549256ca06e884d843f7d 100644 (file)
  * @package 
  */
 
-function xmldb_message_jabber_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_message_jabber_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
     if ($result && $oldversion < 2008072401) {
index 05783400b46ad9a32a8fd6f90d291cc9b5f51306..ecbcabea870b0ff623e0db298801a52a995ee0b7 100644 (file)
  * @package 
  */
 
-function xmldb_message_popup_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_message_popup_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
     if ($result && $oldversion < 2008072401) {
index 914b399363c1f1f4e6f617ccab51834ee8f43c28..5ebd22c63a643e6e2f3cf6b95276d73d2ee1a5b3 100644 (file)
 //
 // 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_assignment_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_assignment_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
 
     if ($result && $oldversion < 2007101511) {
-        notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
         // change grade typo to text if no grades MDL-13920
         require_once $CFG->dirroot.'/mod/assignment/lib.php';
-        // too much debug output
-        $DB->set_debug(false);
-        assignment_update_grades();
-        $DB->set_debug(true);
+        assignment_upgrade_grades();
         upgrade_mod_savepoint($result, 2007101511, 'assignment');
     }
 
@@ -59,10 +58,11 @@ function xmldb_assignment_upgrade($oldversion=0) {
             $pbar = new progress_bar('migrateassignmentfiles', 500, true);
 
             $olddebug = $DB->get_debug();
-//            $DB->set_debug(false); // lower debug level, there might be many files
+            $DB->set_debug(false); // lower debug level, there might be many files
             $i = 0;
             foreach ($rs as $submission) {
                 $i++;
+                upgrade_set_timeout(180); // set up timeout, may also abort execution
                 $basepath = "$CFG->dataroot/$submission->course/$CFG->moddata/assignment/$submission->assignment/$submission->userid/";
                 if (!file_exists($basepath)) {
                     //no files
index 30ef3c3bf5bd6688f084613327febaac92dcda49..ecfae647fd5e626b3642b6621d61a90ad9628434 100644 (file)
@@ -2212,41 +2212,60 @@ function assignment_get_user_grades($assignment, $userid=0) {
 }
 
 /**
- * Update grades by firing grade_updated event
+ * Update activity grades
  *
- * @param object $assignment null means all assignments
- * @param int $userid specific user only, 0 mean all
+ * @param object $assignment
+ * @param int $userid specific user only, 0 means all
  */
-function assignment_update_grades($assignment=null, $userid=0, $nullifnone=true) {
+function assignment_update_grades($assignment, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
     require_once($CFG->libdir.'/gradelib.php');
 
-    if ($assignment != null) {
-        if ($grades = assignment_get_user_grades($assignment, $userid)) {
-            foreach($grades as $k=>$v) {
-                if ($v->rawgrade == -1) {
-                    $grades[$k]->rawgrade = null;
-                }
+    if ($assignment->grade == 0) {
+        assignment_grade_item_update($assignment);
+
+    } else if ($grades = assignment_get_user_grades($assignment, $userid)) {
+        foreach($grades as $k=>$v) {
+            if ($v->rawgrade == -1) {
+                $grades[$k]->rawgrade = null;
             }
-            assignment_grade_item_update($assignment, $grades);
-        } else {
-            assignment_grade_item_update($assignment);
         }
+        assignment_grade_item_update($assignment, $grades);
 
     } else {
-        $sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid
-                  FROM {assignment} a, {course_modules} cm, {modules} m
-                 WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $assignment) {
-                if ($assignment->grade != 0) {
-                    assignment_update_grades($assignment);
-                } else {
-                    assignment_grade_item_update($assignment);
-                }
-            }
-            $rs->close();
-        }
+        assignment_grade_item_update($assignment);
+    }
+}
+
+/**
+ * Update all grades in gradebook.
+ */
+function assignment_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {assignment} a, {course_modules} cm, {modules} m
+             WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
+              FROM {assignment} a, {course_modules} cm, {modules} m
+             WHERE m.name='assignment' AND m.id=cm.module AND cm.instance=a.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        // too much debug output
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('assignmentupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $assignment) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            assignment_update_grades($assignment);
+            $pbar->update($i, $count, "Updating Assignment grades ($i/$count).");
+        }
+        $DB->set_debug($prevdebug);
+        $rs->close();
+        upgrade_set_timeout(); // reset to default timeout
     }
 }
 
index 284e69c84acc094cafdaf0c03b89db3e3e4dee5c..acf4d72a887ce016e778a46d39b1c9c014a5881f 100644 (file)
 //
 // 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_chat_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_chat_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager();
-
     $result = true;
 
+//===== 1.9.0 upgrade line ======//
+
     if ($result && $oldversion < 2008072400) {
 
     /// Define table chat_messages_current to be created
@@ -48,10 +51,8 @@ function xmldb_chat_upgrade($oldversion=0) {
         $table->add_index('groupid', XMLDB_INDEX_NOTUNIQUE, array('groupid'));
         $table->add_index('timestamp-chatid', XMLDB_INDEX_NOTUNIQUE, array('timestamp', 'chatid'));
 
-    /// Conditionally launch create table for chat_messages_current
-        if (!$dbman->table_exists($table)) {
-            $dbman->create_table($table);
-        }
+    /// create table for chat_messages_current
+        $dbman->create_table($table);
 
     /// chat savepoint reached
         upgrade_mod_savepoint($result, 2008072400, 'chat');
index b8e04bc27b4bfb94a6791c678cb8c80394d64e06..e57af6195918b53982eb7d0bb3f4f5b4615b701c 100644 (file)
 //
 // 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_choice_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_choice_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
-/// }
-
 //===== 1.9.0 upgrade line ======//
 
     return $result;
index 3bc3fdb13fda7465cf90a4d911c563a4def22d29..e0731452ec1fc4983b8a9ffd8a1bc7f164c1d572 100644 (file)
 //
 // 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_data_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_data_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager();
-
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
index 2f9aafd25e02474bfde00063c3b12af28185d725..807a835968fc6682fd5c8a35cc4f37cbcfef17ac 100755 (executable)
@@ -798,43 +798,60 @@ function data_get_user_grades($data, $userid=0) {
 }
 
 /**
- * Update grades by firing grade_updated event
+ * Update activity grades
  *
- * @param object $data null means all databases
- * @param int $userid specific user only, 0 mean all
+ * @param object $data
+ * @param int $userid specific user only, 0 means all
  */
-function data_update_grades($data=null, $userid=0, $nullifnone=true) {
+function data_update_grades($data, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
     require_once($CFG->libdir.'/gradelib.php');
 
-    if ($data != null) {
-        if ($grades = data_get_user_grades($data, $userid)) {
-            data_grade_item_update($data, $grades);
+    if (!$data->assessed) {
+        data_grade_item_update($data);
 
-        } else if ($userid and $nullifnone) {
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = NULL;
-            data_grade_item_update($data, $grade);
+    } else if ($grades = data_get_user_grades($data, $userid)) {
+        data_grade_item_update($data, $grades);
 
-        } else {
-            data_grade_item_update($data);
-        }
+    } else if ($userid and $nullifnone) {
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = NULL;
+        data_grade_item_update($data, $grade);
 
     } else {
-        $sql = "SELECT d.*, cm.idnumber as cmidnumber
-                  FROM {data} d, {course_modules} cm, {modules} m
-                 WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $data) {
-                if ($data->assessed) {
-                    data_update_grades($data, 0, false);
-                } else {
-                    data_grade_item_update($data);
-                }
-            }
-            $rs->close();
-        }
+        data_grade_item_update($data);
+    }
+}
+
+/**
+ * Update all grades in gradebook.
+ */
+function data_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {data} d, {course_modules} cm, {modules} m
+             WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT d.*, cm.idnumber AS cmidnumber, d.course AS courseid
+              FROM {data} d, {course_modules} cm, {modules} m
+             WHERE m.name='data' AND m.id=cm.module AND cm.instance=d.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        // too much debug output
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('dataupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $data) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            data_update_grades($data, 0, false);
+            $pbar->update($i, $count, "Updating Database grades ($i/$count).");
+        }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
index eff04e9f60a4fd31a3d5d50976868faf0589f952..45155a25cfeefb406e12db8ff09901d74d72367a 100755 (executable)
@@ -64,7 +64,7 @@
             } else if ($rating != $oldrating->rating) {
                 $oldrating->rating = $rating;
                 if (!$DB->update_record('data_ratings', $oldrating)) {
-                    print_error('cannotupdaterate', 'data', '', array($record->id, $rating));
+                    print_error('cannotupdaterate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
                 }
                 data_update_grades($data, $record->userid);
 
@@ -76,7 +76,7 @@
             $newrating->recordid = $record->id;
             $newrating->rating   = $rating;
             if (! $DB->insert_record('data_ratings', $newrating)) {
-                print_error('cannotinsertrate', 'data', '', array($record->id, $rating));
+                print_error('cannotinsertrate', 'error', '', (object)array('id'=>$record->id, 'rating'=>$rating));
             }
             data_update_grades($data, $record->userid);
         }
index feb2535046fb51b58396942952a463c5ac12a28e..8d5fc1661d892f41c7eeb9f317d0f4b46b3d5f82 100644 (file)
 //
 // 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_feedback_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_feedback_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager();
-
     $result = true;
 
     if ($result && $oldversion < 2007012310) {
index b11246cd9649975fa3374d6090f846e9476114f1..a7a0c22034580c0cfd7385d2c52e790d6f34c8e7 100644 (file)
 //
 // 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_forum_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_forum_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager(); // loads ddl manager and xmldb classes
-
     $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
-/// }
-
 //===== 1.9.0 upgrade line ======//
 
     if ($result and $oldversion < 2007101511) {
-        notify('Processing forum grades, this may take a while if there are many forums...', 'notifysuccess');
         //MDL-13866 - send forum ratins to gradebook again
         require_once($CFG->dirroot.'/mod/forum/lib.php');
-        // too much debug output
-        $DB->set_debug(false);
-        forum_update_grades();
-        $DB->set_debug(true);
-
+        forum_upgrade_grades();
         upgrade_mod_savepoint($result, 2007101511, 'forum');
     }
 
index 3c88ccf74f773922c2615312e2f2599eb50e23e1..d5c9a3580a85a5057701cb361266b3d70a6e302a 100644 (file)
@@ -1424,45 +1424,62 @@ function forum_get_user_grades($forum, $userid=0) {
 }
 
 /**
- * Update grades by firing grade_updated event
+ * Update activity grades
  *
- * @param object $forum null means all forums
- * @param int $userid specific user only, 0 mean all
+ * @param object $forum
+ * @param int $userid specific user only, 0 means all
  * @param boolean $nullifnone return null if grade does not exist
  * @return void
  */
-function forum_update_grades($forum=null, $userid=0, $nullifnone=true) {
+function forum_update_grades($forum, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
+    require_once($CFG->libdir.'/gradelib.php');
 
-    if ($forum != null) {
-        require_once($CFG->libdir.'/gradelib.php');
-        if ($grades = forum_get_user_grades($forum, $userid)) {
-            forum_grade_item_update($forum, $grades);
+    if (!$forum->assessed) {
+        forum_grade_item_update($forum);
 
-        } else if ($userid and $nullifnone) {
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = NULL;
-            forum_grade_item_update($forum, $grade);
+    } else if ($grades = forum_get_user_grades($forum, $userid)) {
+        forum_grade_item_update($forum, $grades);
 
-        } else {
-            forum_grade_item_update($forum);
-        }
+    } else if ($userid and $nullifnone) {
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = NULL;
+        forum_grade_item_update($forum, $grade);
 
     } else {
-        $sql = "SELECT f.*, cm.idnumber as cmidnumber
-                  FROM {forum} f, {course_modules} cm, {modules} m
-                 WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $forum) {
-                if ($forum->assessed) {
-                    forum_update_grades($forum, 0, false);
-                } else {
-                    forum_grade_item_update($forum);
-                }
-            }
-            $rs->close();
-        }
+        forum_grade_item_update($forum);
+    }
+}
+
+/**
+ * Update all grades in gradebook.
+ */
+function forum_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {forum} f, {course_modules} cm, {modules} m
+             WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT f.*, cm.idnumber AS cmidnumber, f.course AS courseid
+              FROM {forum} f, {course_modules} cm, {modules} m
+             WHERE m.name='forum' AND m.id=cm.module AND cm.instance=f.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        // too much debug output
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('forumupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $forum) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            forum_update_grades($forum, 0, false);
+            $pbar->update($i, $count, "Updating Forum grades ($i/$count).");
+        }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
index 276c04e33b3ec5716a9ebfbfbbd5368e297bcb31..b9d8afd3c4803079a53fb8bbdd34d07afcd9cbe0 100644 (file)
@@ -71,8 +71,7 @@
                     $oldrating->rating = $rating;
                     $oldrating->time   = time();
                     if (!$DB->update_record('forum_ratings', $oldrating)) {
-                        print_error('cannotupdaterate', 'forum', '',
-                                array($post->id, $rating));
+                        print_error('cannotupdaterate', 'error', '', (object)array('id'=>$post->id, 'rating'=>$rating));
                     }
                     forum_update_grades($forum, $post->userid);
                 }
@@ -85,8 +84,7 @@
                 $newrating->rating = $rating;
 
                 if (! $DB->insert_record('forum_ratings', $newrating)) {
-                    print_error('cannotinsertrate', 'forum', '',
-                            array($postid, $rating));
+                    print_error('cannotinsertrate', 'error', '', (object)array('id'=>$postid, 'rating'=>$rating));
                 }
                 forum_update_grades($forum, $post->userid);
             }
index ca1a3991231e89cfbfd81e654c0d5422c7ea7421..876148fca38b1799c2ee5da15fd6005eb8d6ed9f 100644 (file)
 //
 // 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_glossary_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_glossary_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
-/// }
-    
 //===== 1.9.0 upgrade line ======//
 
     return $result;
index ae8a016ec03cf2a4afbc5a5ee2078ad2ae33efd7..48681cbd9cc9724644007a9fb8aad3ba77aaccb2 100644 (file)
@@ -323,43 +323,59 @@ function glossary_get_user_grades($glossary, $userid=0) {
 }
 
 /**
- * Update grades by firing grade_updated event
+ * Update activity grades
  *
  * @param object $glossary null means all glossaries
- * @param int $userid specific user only, 0 mean all
+ * @param int $userid specific user only, 0 means all
  */
 function glossary_update_grades($glossary=null, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
     require_once($CFG->libdir.'/gradelib.php');
 
-    if ($glossary != null) {
-        if ($grades = glossary_get_user_grades($glossary, $userid)) {
-            glossary_grade_item_update($glossary, $grades);
+    if (!$glossary->assessed) {
+        glossary_grade_item_update($glossary);
 
-        } else if ($userid and $nullifnone) {
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = NULL;
-            glossary_grade_item_update($glossary, $grade);
+    } else if ($grades = glossary_get_user_grades($glossary, $userid)) {
+        glossary_grade_item_update($glossary, $grades);
 
-        } else {
-            glossary_grade_item_update($glossary);
-        }
+    } else if ($userid and $nullifnone) {
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = NULL;
+        glossary_grade_item_update($glossary, $grade);
 
     } else {
-        $sql = "SELECT g.*, cm.idnumber as cmidnumber
-                  FROM {glossary} g, {course_modules} cm, {modules} m
-                 WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $glossary) {
-                if ($glossary->assessed) {
-                    glossary_update_grades($glossary, 0, false);
-                } else {
-                    glossary_grade_item_update($glossary);
-                }
-            }
-            $rs->close();
-        }
+        glossary_grade_item_update($glossary);
+    }
+}
+
+/**
+ * Update all grades in gradebook.
+ */
+function glossary_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {glossary} g, {course_modules} cm, {modules} m
+             WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT g.*, cm.idnumber AS cmidnumber, g.course AS courseid
+              FROM {glossary} g, {course_modules} cm, {modules} m
+             WHERE m.name='glossary' AND m.id=cm.module AND cm.instance=g.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('glossaryupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $glossary) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            glossary_update_grades($glossary, 0, false);
+            $pbar->update($i, $count, "Updating Glossary grades ($i/$count).");
+        }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
index 2dd714a73cc4951134d0244bc636e611c42226a1..58f2a9f6900465f00169d8c5b06e7eac2b2be36d 100644 (file)
@@ -77,7 +77,7 @@
                     $oldrating->rating = $rating;
                     $oldrating->time = time();
                     if (! $DB->update_record("glossary_ratings", $oldrating)) {
-                        print_error('cannotinsertrate', '', '', array($entry, $rating));
+                        print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
                     }
                     glossary_update_grades($glossary, $entry->userid);
                 }
@@ -90,7 +90,7 @@
                 $newrating->rating  = $rating;
 
                 if (! $DB->insert_record("glossary_ratings", $newrating)) {
-                    print_error('cannotinsertrate', '', '', array($entry->id, $rating));
+                    print_error('cannotinsertrate', 'error', '', (object)array('id'=>$entry->id, 'rating'=>$rating));
                 }
                 glossary_update_grades($glossary, $entry->userid);
             }
index ec2d495ba22037632343d047ae1f69d9a573a354..158927a6ea496008bfc6c1f30e22501bc34aea96 100644 (file)
@@ -1,29 +1,23 @@
 <?php  //$Id$
 
 // This file keeps track of upgrades to the hotpot module
+//
+// Please do not forget to use upgrade_set_timeout()
+// before any action that may take longer time to finish.
 
-function xmldb_hotpot_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_hotpot_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
 
     // update hotpot grades from sites earlier than Moodle 1.9, 27th March 2008
     if ($result && $oldversion < 2007101511) {
-
-        // ensure "hotpot_update_grades" function is available
+        // ensure "hotpot_upgrade_grades" function is available
         require_once $CFG->dirroot.'/mod/hotpot/lib.php';
-
-        // disable display of debugging messages
-        $DB->set_debug(false);
-
-        notify('Processing hotpot grades, this may take a while if there are many hotpots...', 'notifysuccess');
-        hotpot_update_grades();
-
-        // restore debug
-        $DB->set_debug(true);
+        hotpot_upgrade_grades();
     }
 
     return $result;
index 6dbc93fd95d59948ca722948224469a56862d9b3..eceecb0224759be97a16d50f24351e3c2b323124 100644 (file)
@@ -1256,46 +1256,63 @@ function hotpot_get_user_grades($hotpot, $userid=0) {
 
 /**
  * Update grades in central gradebook
- * this function is called from db/upgrade.php
- *     it is initially called with no arguments, which forces it to get a list of all hotpots
- *     it then iterates through the hotpots, calling itself to create a grade record for each hotpot
- *
- * @param object $hotpot null means all hotpots
+ * @param object $hotpot
  * @param int $userid specific user only, 0 means all users
  */
-function hotpot_update_grades($hotpot=null, $userid=0, $nullifnone=true) {
+function hotpot_update_grades($hotpot, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
     require_once($CFG->libdir.'/gradelib.php');
 
-    if (is_null($hotpot)) {
-        // update (=create) grades for all hotpots
-        $sql = "
-            SELECT h.*, cm.idnumber as cmidnumber
-            FROM {hotpot} h, {course_modules} cm, {modules} m
-            WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id"
-        ;
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $hotpot) {
-                hotpot_update_grades($hotpot, 0, false);
-            }
-            $rs->close();
-        }
+    // update (=create) grade for a single hotpot
+    if ($grades = hotpot_get_user_grades($hotpot, $userid)) {
+        hotpot_grade_item_update($hotpot, $grades);
+
+    } else if ($userid && $nullifnone) {
+        // no grades for this user, but we must force the creation of a "null" grade record
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = null;
+        hotpot_grade_item_update($hotpot, $grade);
+
     } else {
-        // update (=create) grade for a single hotpot
-        if ($grades = hotpot_get_user_grades($hotpot, $userid)) {
-            hotpot_grade_item_update($hotpot, $grades);
+        // no grades and no userid
+        hotpot_grade_item_update($hotpot);
+    }
+}
 
-        } else if ($userid && $nullifnone) {
-            // no grades for this user, but we must force the creation of a "null" grade record
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = null;
-            hotpot_grade_item_update($hotpot, $grade);
+/**
+ * Update all grades in gradebook.
+ * this function is called from db/upgrade.php
+ *     it iterates through the hotpots, calling hotpot_update_grades() to create a grade record for each hotpot
+ */
+function hotpot_upgrade_grades() {
+    global $DB;
 
-        } else {
-            // no grades and no userid
-            hotpot_grade_item_update($hotpot);
+    // upgrade (=create) grades for all hotpots
+    $sql = "
+        SELECT COUNT('x')
+        FROM {hotpot} h, {course_modules} cm, {modules} m
+        WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "
+        SELECT h.*, cm.idnumber AS cmidnumber
+        FROM {hotpot} h, {course_modules} cm, {modules} m
+        WHERE m.name='hotpot' AND m.id=cm.module AND cm.instance=h.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        // too much debug output
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('hotpotupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $hotpot) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            hotpot_update_grades($hotpot, 0, false);
+            $pbar->update($i, $count, "Updating Hotpot grades ($i/$count).");
         }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
@@ -1479,9 +1496,6 @@ class hotpot_xml_tree {
         if (empty($str)) {
             $this->xml =  array();
         } else {
-            if (empty($CFG->unicodedb)) {
-                $str = utf8_encode($str);
-            }
             $this->xml =  xmlize($str, 0);
         }
         $this->xml_root = $xml_root;
@@ -1492,9 +1506,6 @@ class hotpot_xml_tree {
         eval('$value = &$this->xml'.$this->xml_root.$tags.$more_tags.';');
 
         if (is_string($value)) {
-            if (empty($CFG->unicodedb)) {
-                $value = utf8_decode($value);
-            }
 
             // decode angle brackets
             $value = strtr($value, array('&#x003C;'=>'<', '&#x003E;'=>'>', '&#x0026;'=>'&'));
index 9f5c5a5a680e7c59de789e31c365371c2da29126..b975c1836569f0ef7c1a5353c8a9a15435bb5ef9 100644 (file)
 //
 // 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_label_upgrade($oldversion=0) {
-    global $CFG, $THEME, $DB;
+function xmldb_label_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
-/// }
-
 //===== 1.9.0 upgrade line ======//
+
     if ($oldversion < 2007101510) {
         $sql = "UPDATE {log_display} SET mtable = 'label' WHERE module = 'label'";
         $result = $DB->execute($sql);
index 91b1f0a3cb69a89383919e6027bcd6f5d92530c3..cf44533725d8b0a2fa697dbf2737f33841938528 100644 (file)
 //
 // 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_lesson_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_lesson_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager();
-
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
index 173726dadee9f237f32cdafa110fcd993a96c4e6..9b7998b77877a9677b203fb34db716fd967b8122 100644 (file)
@@ -385,43 +385,57 @@ function lesson_get_user_grades($lesson, $userid=0) {
 /**
  * Update grades in central gradebook
  *
- * @param object $lesson null means all lessons
- * @param int $userid specific user only, 0 mean all
+ * @param object $lesson
+ * @param int $userid specific user only, 0 means all
  */
-function lesson_update_grades($lesson=null, $userid=0, $nullifnone=true) {
+function lesson_update_grades($lesson, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
-    if (!function_exists('grade_update')) { //workaround for buggy PHP versions
-        require_once($CFG->libdir.'/gradelib.php');
-    }
+    require_once($CFG->libdir.'/gradelib.php');
 
-    if ($lesson != null) {
-        if ($grades = lesson_get_user_grades($lesson, $userid)) {
-            lesson_grade_item_update($lesson, $grades);
+    if ($lesson->grade == 0) {
+        lesson_grade_item_update($lesson);
 
-        } else if ($userid and $nullifnone) {
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = NULL;
-            lesson_grade_item_update($lesson, $grade);
+    } else if ($grades = lesson_get_user_grades($lesson, $userid)) {
+        lesson_grade_item_update($lesson, $grades);
 
-        } else {
-            lesson_grade_item_update($lesson);
-        }
+    } else if ($userid and $nullifnone) {
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = NULL;
+        lesson_grade_item_update($lesson, $grade);
 
     } else {
-        $sql = "SELECT l.*, cm.idnumber as cmidnumber, l.course as courseid
-                  FROM {lesson} l, {course_modules} cm, {modules} m
-                 WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $lesson) {
-                if ($lesson->grade != 0) {
-                    lesson_update_grades($lesson, 0, false);
-                } else {
-                    lesson_grade_item_update($lesson);
-                }
-            }
-            $rs->close();
+        lesson_grade_item_update($lesson);
+    }
+}
+
+/**
+ * Update all grades in gradebook.
+ */
+function lesson_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {lesson} l, {course_modules} cm, {modules} m
+             WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT l.*, cm.idnumber AS cmidnumber, l.course AS courseid
+              FROM {lesson} l, {course_modules} cm, {modules} m
+             WHERE m.name='lesson' AND m.id=cm.module AND cm.instance=l.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('lessonupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $lesson) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            lesson_update_grades($lesson, 0, false);
+            $pbar->update($i, $count, "Updating Lesson grades ($i/$count).");
         }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
index 6a0b0420f730c16c83a6699acddc234ec09d637a..d3ec9b890d33fb7d1e1624e5c5befa8dfd53f502 100644 (file)
 //
 // 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_quiz_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_quiz_upgrade($oldversion) {
+    global $CFG, $DB;
     
     $dbman = $DB->get_manager();
-
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
index df5ce08c768ed0495b91fdf897578128f3f32323..6492cd9702bec019b02530a2cdeba4d9092149cd 100644 (file)
@@ -310,43 +310,57 @@ function quiz_format_grade($quiz, $grade) {
 /**
  * Update grades in central gradebook
  *
- * @param object $quiz null means all quizs
- * @param int $userid specific user only, 0 mean all
+ * @param object $quiz
+ * @param int $userid specific user only, 0 means all
  */
-function quiz_update_grades($quiz=null, $userid=0, $nullifnone=true) {
+function quiz_update_grades($quiz, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
-    if (!function_exists('grade_update')) { //workaround for buggy PHP versions
-        require_once($CFG->libdir.'/gradelib.php');
-    }
+    require_once($CFG->libdir.'/gradelib.php');
 
-    if ($quiz != null) {
-        if ($grades = quiz_get_user_grades($quiz, $userid)) {
-            quiz_grade_item_update($quiz, $grades);
+    if ($quiz->grade == 0) {
+        quiz_grade_item_update($quiz);
 
-        } else if ($userid and $nullifnone) {
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = NULL;
-            quiz_grade_item_update($quiz, $grade);
+    } else if ($grades = quiz_get_user_grades($quiz, $userid)) {
+        quiz_grade_item_update($quiz, $grades);
 
-        } else {
-            quiz_grade_item_update($quiz);
-        }
+    } else if ($userid and $nullifnone) {
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = NULL;
+        quiz_grade_item_update($quiz, $grade);
 
     } else {
-        $sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid
-                  FROM {quiz} a, {course_modules} cm, {modules} m
-                 WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $quiz) {
-                if ($quiz->grade != 0) {
-                    quiz_update_grades($quiz, 0, false);
-                } else {
-                    quiz_grade_item_update($quiz);
-                }
-            }
-            $rs->close();
+        quiz_grade_item_update($quiz);
+    }
+}
+    
+/**
+ * Update all grades in gradebook.
+ */
+function quiz_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {quiz} a, {course_modules} cm, {modules} m
+             WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT a.*, cm.idnumber AS cmidnumber, a.course AS courseid
+              FROM {quiz} a, {course_modules} cm, {modules} m
+             WHERE m.name='quiz' AND m.id=cm.module AND cm.instance=a.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('quizupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $quiz) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            quiz_update_grades($quiz, 0, false);
+            $pbar->update($i, $count, "Updating Quiz grades ($i/$count).");
         }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
index fc2c59e372942590a60252c1e86629f4b7be76b9..884a227f09d4cd5199e662d4b0c67bbe13f0b722 100644 (file)
@@ -20,7 +20,7 @@ class page_quiz extends page_generic_activity {
 
     function init_quick($data) {
         if(empty($data->pageid)) {
-            print_error('cannotinitpage', '', '', null);
+            print_error('cannotinitpage', 'debug', '', (object)array('name'=>'quiz', 'id'=>'?'));
         }
         $this->activityname = 'quiz';
         parent::init_quick($data);
index bee8b66ce1b7b9d731cfab1dde96b144586d0c87..57ae3a93b9eb143ea3cdbf7ac35bf5f55a981ee1 100644 (file)
@@ -1,11 +1,9 @@
 <?php  // $Id$
 
-function xmldb_quizreport_overview_upgrade($oldversion=0) {
+function xmldb_quizreport_overview_upgrade($oldversion) {
+    global $CFG, $DB;
 
-    global $CFG, $THEME, $DB;
-    
     $dbman = $DB->get_manager();
-
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
index e8e007870fb1c67d48d92aaa0e3d0fc9acf46133..d6ec6023a8d829b3b1ad6a455df03f449fb23f8a 100644 (file)
@@ -1,6 +1,6 @@
 <?php  // $Id$
 
-function xmldb_quizreport_statistics_upgrade($oldversion=0) {
+function xmldb_quizreport_statistics_upgrade($oldversion) {
 
     global $DB;
     
index 893d862efcd147958f9b456169b10bdb9a452b19..8a00a2c7c1a84d90b0aaccfcbf454414f22c3217 100644 (file)
 //
 // 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_resource_upgrade($oldversion=0) {
-    global $CFG, $THEME, $DB;
+function xmldb_resource_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
-/// }
-
 //===== 1.9.0 upgrade line ======//
 
     return $result;
index 31064785e6d9d19d3a43a19e24226ffa87f68886..1a0c0ab9b09068b0f8c7f65494accf9511625e6e 100644 (file)
 //
 // 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_scorm_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_scorm_upgrade($oldversion) {
+    global $CFG, $DB;
 
     $dbman = $DB->get_manager();
-
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
@@ -34,7 +35,7 @@ function xmldb_scorm_upgrade($oldversion=0) {
         $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod');
         
         /// Launch add field whatgrade
-        if(!$dbman->field_exists($table,$field)) {
+        if (!$dbman->field_exists($table,$field)) {
             $dbman->add_field($table, $field);
         }
         
index c7e61fed8ed1bf503fee2635ce6c1da8785f8c35..f82f8357d243a561c410a61cdc22663c109a0ea0 100755 (executable)
@@ -441,39 +441,54 @@ function scorm_get_user_grades($scorm, $userid=0) {
 /**
  * Update grades in central gradebook
  *
- * @param object $scorm null means all scormbases
+ * @param object $scorm
  * @param int $userid specific user only, 0 mean all
  */
-function scorm_update_grades($scorm=null, $userid=0, $nullifnone=true) {
+function scorm_update_grades($scorm, $userid=0, $nullifnone=true) {
     global $CFG, $DB;
-    if (!function_exists('grade_update')) { //workaround for buggy PHP versions
-        require_once($CFG->libdir.'/gradelib.php');
-    }
+    require_once($CFG->libdir.'/gradelib.php');
 
-    if ($scorm != null) {
-        if ($grades = scorm_get_user_grades($scorm, $userid)) {
-            scorm_grade_item_update($scorm, $grades);
+    if ($grades = scorm_get_user_grades($scorm, $userid)) {
+        scorm_grade_item_update($scorm, $grades);
 
-        } else if ($userid and $nullifnone) {
-            $grade = new object();
-            $grade->userid   = $userid;
-            $grade->rawgrade = NULL;
-            scorm_grade_item_update($scorm, $grade);
-
-        } else {
-            scorm_grade_item_update($scorm);
-        }
+    } else if ($userid and $nullifnone) {
+        $grade = new object();
+        $grade->userid   = $userid;
+        $grade->rawgrade = NULL;
+        scorm_grade_item_update($scorm, $grade);
 
     } else {
-        $sql = "SELECT s.*, cm.idnumber as cmidnumber
-                  FROM {scorm} s, {course_modules} cm, {modules} m
-                 WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
-        if ($rs = $DB->get_recordset_sql($sql)) {
-            foreach ($rs as $scorm) {
-                scorm_update_grades($scorm, 0, false);
-            }
-            $rs->close();
+        scorm_grade_item_update($scorm);
+    }
+}
+
+/**
+ * Update all grades in gradebook.
+ */
+function scorm_upgrade_grades() {
+    global $DB;
+
+    $sql = "SELECT COUNT('x')
+              FROM {scorm} s, {course_modules} cm, {modules} m
+             WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
+    $count = $DB->count_records_sql($sql);
+
+    $sql = "SELECT s.*, cm.idnumber AS cmidnumber, s.course AS courseid
+              FROM {scorm} s, {course_modules} cm, {modules} m
+             WHERE m.name='scorm' AND m.id=cm.module AND cm.instance=s.id";
+    if ($rs = $DB->get_recordset_sql($sql)) {
+        $prevdebug = $DB->get_debug();
+        $DB->set_debug(false);
+        $pbar = new progress_bar('scormupgradegrades', 500, true);
+        $i=0;
+        foreach ($rs as $scorm) {
+            $i++;
+            upgrade_set_timeout(60*5); // set up timeout, may also abort execution
+            scorm_update_grades($scorm, 0, false);
+            $pbar->update($i, $count, "Updating Scorm grades ($i/$count).");
         }
+        $DB->set_debug($prevdebug);
+        $rs->close();
     }
 }
 
index cb26e843180336555d39fd52b562f711882e634f..18dde0c6365c267ed027314336b626e9c71d0ce9 100644 (file)
 //
 // 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_survey_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_survey_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
-/// }
-
 //===== 1.9.0 upgrade line ======//
 
     return $result;
index 24806e82c99861d4d41aa300f169c76951a31c84..86bb4c28e48a4d0946cd56b39716d003ab6747ad 100644 (file)
 //
 // 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_wiki_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_wiki_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
-/// }
-
 //===== 1.9.0 upgrade line ======//
 
     return $result;
index 05c6c2823d9651b5585b9caedcc4611c26fe0781..925230445fa90e7894c3fdab5d71f5b7de8cbd61 100644 (file)
 //
 // 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_qtype_calculated_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_calculated_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index d3017c73686ec737267f5421f6ced02b0bdc77de..b4675ceece0fdba2211843228e01bfe4a295e6bc 100644 (file)
 //
 // 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_qtype_datasetdependent_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_datasetdependent_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index b98d8fb5a503c5b1702fed24dd3c1ee408dbf3e1..0ec034a1151cd8cbfe4e857b922d467880f5cfae 100644 (file)
 //
 // 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_qtype_essay_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_essay_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 16d352b3a45aa10fe4fdf1a6acdbe1341b160fb3..77f555cefc96f3fbb11fe025053dfe27ad9b6d63 100644 (file)
 //
 // 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_qtype_match_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_match_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index e1d5b2ffaa2222d0a1c3e8d50a828af8a848384f..c0f732b6a0441ff0f0f8eee139e11be53e23c340 100644 (file)
 //
 // 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_qtype_multianswer_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_multianswer_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
-/// }
-
     if ($result && $oldversion < 2008050800) {
         question_multianswer_fix_subquestion_parents_and_categories();
     }
index c2ec89247d77165073eb7387a34285a5e54fe29a..cc8041c11b06c6361048ec5e68b2ba7a5660ce87 100644 (file)
 //
 // 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_qtype_multichoice_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_multichoice_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
     return $result;
index 75d80651adf7fcb7e38a29d636e65d27060045a8..57813f207f9aae6e4069730aeafb4f42195559b6 100644 (file)
 //
 // 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_qtype_numerical_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_numerical_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 //===== 1.9.0 upgrade line ======//
index 02ac7a2b36bff8f884b96a9689d531eb24745fff..dcefd68934aabf729cb226a846a2a54cdf106961 100644 (file)
 //
 // 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_qtype_randomsamatch_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_randomsamatch_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index d38673d9ce86b975e05853dcf37a8932d312dd88..e0097e0abb7d72a2f7e8b0e040f0cd1fa1ad8e96 100644 (file)
 //
 // 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_qtype_shortanswer_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_shortanswer_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index c10321a9bb3ba6981814c7b027e57419233e6a9c..c2b85e99bbc7706eee9bc0a3ad3501d5f6cd6dbf 100644 (file)
 //
 // 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_qtype_truefalse_upgrade($oldversion=0) {
-
-    global $CFG, $THEME, $DB;
+function xmldb_qtype_truefalse_upgrade($oldversion) {
+    global $CFG, $DB;
 
+    $dbman = $DB->get_manager();
     $result = true;
 
 /// And upgrade begins here. For each one, you'll need one 
index 89d07652225cad947bb1dd955f65e1c870fe6534..e1c99e53b73950a8c6548bb76894bd042271fa44 100644 (file)
                 $iconpath = $CFG->modpixpath.'/'.$listing->doctype.'/icon.gif';
                 $coursename = get_field('course', 'fullname', 'id', $listing->courseid);
                 $courseword = mb_convert_case(get_string('course', 'moodle'), MB_CASE_LOWER, 'UTF-8');
-                //if ($CFG->unicodedb) {
-                //$listing->title = mb_convert_encoding($listing->title, 'auto', 'UTF8');
-                //}
                 $title_post_processing_function = $listing->doctype.'_link_post_processing';
                 $searchable_instance = $searchables[$listing->doctype];
                 if ($searchable_instance->location == 'internal'){
index ba316786583124bb341354d60ff28f8d5643a244..45e975e52cc2c918937a5c3077463eb457cc5352 100644 (file)
@@ -100,7 +100,7 @@ function useredit_shared_definition(&$mform) {
     $mform->setType('lastname', PARAM_NOTAGS);
 
     // Do not show email field if change confirmation is pending
-    if ($CFG->emailchangeconfirmation && !empty($user->preference_newemail)) {
+    if (!empty($CFG->emailchangeconfirmation) and !empty($user->preference_newemail)) {
         $notice = get_string('auth_emailchangepending', 'auth', $user);
         $notice .= '<br /><a href="edit.php?cancelemailchange=1&amp;id='.$user->id.'">'
                 . get_string('auth_emailchangecancel', 'auth') . '</a>';
@@ -167,7 +167,7 @@ function useredit_shared_definition(&$mform) {
         $mform->setAdvanced('trackforums');
     }
 
-    if ($CFG->htmleditor) {
+    if (!empty($CFG->htmleditor)) {
         $choices = array();
         $choices['0'] = get_string('texteditor');
         $choices['1'] = get_string('htmleditor');
index 30ea002f3c381c3c18a70ea24bdfa45d53889c08..6b18babaaea176e501df0ce2f2a3b71e84eac420 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2008081506;  // YYYYMMDD   = date of the last version bump
+    $version = 2008081600;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20080816)';  // Human-friendly version name