]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17849 sql queries not printed by default during upgrade anymore, there is a new...
authorskodak <skodak>
Mon, 12 Jan 2009 16:52:53 +0000 (16:52 +0000)
committerskodak <skodak>
Mon, 12 Jan 2009 16:52:53 +0000 (16:52 +0000)
24 files changed:
admin/index.php
admin/report/unittest/test_tables.php
config-dist.php
lib/accesslib.php
lib/adminlib.php
lib/blocklib.php
lib/db/install.php
lib/db/upgradelib.php
lib/ddl/database_manager.php
lib/ddl/sql_generator.php
lib/locallib.php
mod/assignment/db/upgrade.php
mod/assignment/lib.php
mod/data/db/upgrade.php
mod/data/lib.php
mod/forum/db/upgrade.php
mod/forum/lib.php
mod/glossary/db/upgrade.php
mod/glossary/lib.php
mod/hotpot/lib.php
mod/lesson/lib.php
mod/quiz/lib.php
mod/scorm/db/upgrade.php
mod/scorm/lib.php

index 95f7c8e1dec5e88776da71addefdaae9ad483d77..d8f1cb6ae9e72e4800f0ae157fd624894cc62916 100644 (file)
     /// return to original debugging level
         $CFG->debug = $origdebug;
         error_reporting($CFG->debug);
-        $DB->set_debug(true);
 
         if (!$DB->setup_is_unicodedb()) {
             if (!$DB->change_db_encoding()) {
             }
         }
 
+        upgrade_log_start(true); // does not store ugprade runnign flag
+        print_heading('coresystem');
         $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml");
-        upgrade_log_start(); // move here because we want the flag to be stored in config table ;-)
+        upgrade_log_start();     // we want the flag to be stored in config table ;-)
 
     /// set all core default records and default settings
         require_once("$CFG->libdir/db/install.php");
         // Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
         admin_apply_default_settings(NULL, true);
         notify($strdatabasesuccess, 'notifysuccess');
-
-        /// do not show certificates in log ;-)
-        $DB->set_debug(false);
+        print_upgrade_separator();
     }
 
 
 
         } else {
 
-            $strdatabasesuccess  = get_string("databasesuccess");
             upgrade_log_start();
 
         /// return to original debugging level
             }
 
             print_heading($strdatabasechecking);
-            $DB->set_debug(true);
         /// Launch the old main upgrade (if exists)
             $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');
-                }
+                update_capabilities();
 
                 // Update core events
                 events_update_definition();
 
                 set_config("version", $version);
                 remove_dir($CFG->dataroot . '/cache', true); // flush cache
-                notify($strdatabasesuccess, "green");
+                notify(get_string("databasesuccess"), "green");
+                print_upgrade_separator();
 
         /// Main upgrade not success
             } else {
index 45fc4c9c993e039c6fbbb8f95bf36d0cee3878d9..ffa358e2b0e17254175a4e4588d9cf61251f0ce5 100644 (file)
@@ -81,9 +81,6 @@ die;die;die;
     // Write default settings unconditionally (i.e. even if a setting is already set, overwrite it)
     admin_apply_default_settings(NULL, true);
 
-    /// do not show certificates in log ;-)
-    $DB->set_debug(false);
-
 
 /// upgrade all plugins types
     $upgradedplugins = false;
index 4f80db927a6d4a775c481f5e515cf80f90ffe19c..cfe4c75d2ddfd144469eea0962699ae178c74871 100644 (file)
@@ -294,16 +294,16 @@ $CFG->admin = 'admin';
 // NOTE: course, category, session, user themes still require the
 // respective settings to be enabled
 //
-// When working with production data on test servers, no emails should ever be send to real users
-// $CFG->noemailever = true;
-//
 
 //=========================================================================
 // 8. SETTINGS FOR DEVELOPMENT SERVERS - not intended for production use!!!
 //=========================================================================
 //
+// When working with production data on test servers, no emails should ever be send to real users
+// $CFG->noemailever = true;
+//
 // Specify prefix for fake unit test tables. If not specified only tests
-// taht do not need fake tables will be executed.
+// that do not need fake tables will be executed.
 // $CFG->unittestprefix = 'tst_';
 //
 // special magic evil developer only wanting to edit the xmldb files manually
@@ -312,12 +312,18 @@ $CFG->admin = 'admin';
 // $CFG->xmldbdisablecommentchecking = true;
 // $CFG->xmldbdisablenextprevchecking = true;
 //
-// special magig evil developer only wanting to edit xmldb files manually
+// Special magic - evil developer only wanting to edit xmldb files manually
 // AND allowing the XMLDBEditor to recostruct the prev/next elements every
 // time one file is loaded and saved (Moodle).
 // Uncomment this if you're lazy like Petr
 // $CFG->xmldbreconstructprevnext = true;
 //
+//
+// Since 2.0 sql queries are not shown during upgrade by default.
+// Please note that this setting may produce very long upgrade page on large sites.
+// $CFG->upgradeshowsql = true;
+
+
 
 //=========================================================================
 // ALL DONE!  To continue installation, visit your main page with a browser
index 5c1dc6483f449d27b498ad26119af55db2743101..a6e26dfd48d4c4bee86e8aa14ada15674f0e894f 100755 (executable)
@@ -1614,6 +1614,10 @@ function compact_rdefs(&$rdefs) {
 function load_all_capabilities() {
     global $USER, $CFG, $DIRTYCONTEXTS;
 
+    if (empty($CFG->rolesactive)) {
+        return;
+    }
+
     $base = '/'.SYSCONTEXTID;
 
     if (isguestuser()) {
@@ -4728,7 +4732,7 @@ function get_users_by_capability($context, $capability, $fields='', $sort='',
 
     // is the default role interesting? does it have
     // a relevant rolecap? (we use this a lot later)
-    if (in_array((int)$CFG->defaultuserroleid, $roleids, true)) {
+    if (isset($CFG->defaultuserroleid) and in_array((int)$CFG->defaultuserroleid, $roleids, true)) {
         $defaultroleinteresting = true;
     } else {
         $defaultroleinteresting = false;
@@ -5993,6 +5997,11 @@ function get_dirty_contexts($time) {
  */
 function mark_context_dirty($path) {
     global $CFG, $DIRTYCONTEXTS;
+
+    if (empty($CFG->rolesactive)) {
+        return;
+    }
+
     // only if it is a non-empty string
     if (is_string($path) && $path !== '') {
         set_cache_flag('accesslib/dirtycontexts', $path, 1, time()+$CFG->sessiontimeout);
index 01d8b30bacf020b6cee3e8f8c3a0c8689ea4c15d..a5a591a93083400703119d50f528c0b717ebfc7d 100644 (file)
@@ -390,9 +390,6 @@ function upgrade_plugins($type, $dir) {
             $updated_plugins = true;
             upgrade_log_start();
             print_heading($dir.'/'. $plugin->name .' plugin needs upgrading');
-            if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                $DB->set_debug(true);
-            }
             @set_time_limit(0);  // To allow slow databases to complete the long SQL
 
             if ($installedversion == 0) {    // It's a new install of this plugin
@@ -402,9 +399,6 @@ function upgrade_plugins($type, $dir) {
                     $DB->get_manager()->install_from_xmldb_file($fullplug . '/db/install.xml'); //New method
                 }
                 $status = true;
-                if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                    $DB->set_debug(false);
-                }
             /// Continue with the instalation, roles and other stuff
                 if ($status) {
                 /// OK so far, now update the plugins record
@@ -439,17 +433,11 @@ function upgrade_plugins($type, $dir) {
                 $newupgrade_function = 'xmldb_' .$plugin->fullname .'_upgrade';
                 $newupgrade_status = true;
                 if ($newupgrade && function_exists($newupgrade_function)) {
-                    if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                        $DB->set_debug(true);
-                    }
                     $newupgrade_status = $newupgrade_function($installedversion);
                 } else if ($newupgrade) {
                     notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
                              $fullplug . '/db/upgrade.php');
                 }
-                if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                    $DB->set_debug(false);
-                }
             /// Now analyze upgrade results
                 if ($newupgrade_status) {    // No upgrading failed
                 /// OK so far, now update the plugins record
@@ -466,9 +454,7 @@ function upgrade_plugins($type, $dir) {
                     notify('Upgrading '. $plugin->name .' from '. $installedversion .' to '. $plugin->version .' FAILED!');
                 }
             }
-            if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                echo '<hr />';
-            }
+            print_upgrade_separator();
         } else {
             print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$installedversion, 'newversion'=>$plugin->version));
         }
@@ -559,17 +545,11 @@ function upgrade_activity_modules() {
             /// Then, the new function if exists and the old one was ok
                 $newupgrade_status = true;
                 if ($newupgrade && function_exists($newupgrade_function)) {
-                    if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                        $DB->set_debug(true);
-                    }
                     $newupgrade_status = $newupgrade_function($currmodule->version, $module);
                 } else if ($newupgrade) {
                     notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
                              $mod . ': ' . $fullmod . '/db/upgrade.php');
                 }
-                if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                    $DB->set_debug(false);
-                }
             /// Now analyze upgrade results
                 if ($newupgrade_status) {    // No upgrading failed
                     // OK so far, now update the modules record
@@ -577,9 +557,7 @@ function upgrade_activity_modules() {
                     $DB->update_record('modules', $module);
                     remove_dir($CFG->dataroot . '/cache', true); // flush cache
                     notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
-                    if (!defined('CLI_UPGRADE') || !CLI_UPGRADE) {
-                       echo '<hr />';
-                    }
+                    print_upgrade_separator();
                 } else {
                     notify('Upgrading '. $module->name .' from '. $currmodule->version .' to '. $module->version .' FAILED!');
                 }
@@ -604,9 +582,6 @@ function upgrade_activity_modules() {
             print_heading($module->name);
             $updated_modules = true;
             // To avoid unnecessary output from the SQL queries in the CLI version
-            if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
-                $DB->set_debug(true);
-            }
             @set_time_limit(0);  // To allow slow databases to complete the long SQL
 
         /// Both old .sql files and new install.xml are supported
@@ -615,9 +590,6 @@ function upgrade_activity_modules() {
                 $DB->get_manager()->install_from_xmldb_file($fullmod . '/db/install.xml'); //New method
                 $status = true;
             }
-            if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                $DB->set_debug(false);
-            }
 
         /// Continue with the installation, roles and other stuff
             if ($status) {
@@ -641,9 +613,7 @@ function upgrade_activity_modules() {
                     }
 
                     notify(get_string('modulesuccess', '', $module->name), 'notifysuccess');
-                    if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE ) {
-                       echo '<hr />';
-                    }
+                    print_upgrade_separator();
                 } else {
                     print_error('cannotaddmodule', '', '', $module->name);
                 }
@@ -852,12 +822,16 @@ function create_admin_user($user_input=NULL) {
  * Marks start of upgrade, blocks any other access to site.
  * The upgrade is finished at the end of script or after timeout.
  */
-function upgrade_log_start() {
+function upgrade_log_start($preinstall=false) {
     global $CFG, $DB;
 
     static $started = false;
 
-    if ($started) {
+    if ($preinstall) {
+        ignore_user_abort(true);
+        upgrade_setup_debug(true);
+
+    } else if ($started) {
         upgrade_set_timeout(120);
 
     } else {
@@ -868,9 +842,11 @@ function upgrade_log_start() {
                 build_navigation(array(array('name' => $strupgrade, 'link' => null, 'type' => 'misc'))), '',
                 upgrade_get_javascript(), false, '&nbsp;', '&nbsp;');
         }
+        //$DB->set_debug(true); // should be configurable soon
 
         ignore_user_abort(true);
         register_shutdown_function('upgrade_finished_handler');
+        upgrade_setup_debug(true);
         set_config('upgraderunning', time()+300);
         $started = true;
     }
@@ -889,9 +865,11 @@ function upgrade_finished_handler() {
  * This function may be called repeatedly.
  */
 function upgrade_log_finish($continueurl=null) {
-    global $CFG;
+    global $CFG, $DB;
+
     if (!empty($CFG->upgraderunning)) {
         unset_config('upgraderunning');
+        upgrade_setup_debug(false);
         ignore_user_abort(false);
         if ($continueurl) {
             print_continue($continueurl);
@@ -901,6 +879,29 @@ function upgrade_log_finish($continueurl=null) {
     }
 }
 
+function upgrade_setup_debug($starting) {
+    global $CFG, $DB;
+
+    static $originaldebug = null;
+
+    if ($starting) {
+        if ($originaldebug === null) {
+            $originaldebug = $DB->get_debug();
+        }
+        if (!empty($CFG->upgradeshowsql)) {
+            $DB->set_debug(true);
+        }
+    } else {
+        $DB->set_debug($originaldebug);
+    }
+}
+
+function print_upgrade_separator() {
+    if (!CLI_SCRIPT) {
+        echo '<hr />';
+    }
+}
+
 /**
  * Test if and critical warnings are present
  * @return bool
index ec7f57df73f1bdf3dce896e4eb94041815c791f4..4727e40fc61d138668a98eec5f716976d822f1b1 100644 (file)
@@ -1183,17 +1183,11 @@ function upgrade_blocks_plugins() {
             /// Then, the new function if exists and the old one was ok
                 $newupgrade_status = true;
                 if ($newupgrade && function_exists($newupgrade_function)) {
-                    if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                        $DB->set_debug(true);
-                    }
                     $newupgrade_status = $newupgrade_function($currblock->version, $block);
                 } else if ($newupgrade) {
                     notify ('Upgrade function ' . $newupgrade_function . ' was not available in ' .
                              $fullblock . '/db/upgrade.php');
                 }
-                if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                    $DB->set_debug(false);
-                }
             /// Now analyze upgrade results
                 if ($newupgrade_status) {    // No upgrading failed
 
@@ -1221,9 +1215,7 @@ function upgrade_blocks_plugins() {
                 } else {
                     notify('Upgrading block '. $block->name .' from '. $currblock->version .' to '. $block->version .' FAILED!');
                 }
-                if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                echo '<hr />';
-                }
+                print_upgrade_separator();
             } else {
                 print_error('cannotdowngrade', 'debug', '', (object)array('oldversion'=>$currblock->version, 'newversion'=>$block->version));
             }
@@ -1249,9 +1241,6 @@ function upgrade_blocks_plugins() {
             $updated_blocks = true;
             upgrade_log_start();
             print_heading($block->name);
-            if (!defined('CLI_UPGRADE')||!CLI_UPGRADE) {
-                $DB->set_debug(true);
-            }
             @set_time_limit(0);  // To allow slow databases to complete the long SQL
 
         /// Both old .sql files and new install.xml are supported
@@ -1259,9 +1248,6 @@ function upgrade_blocks_plugins() {
             if (file_exists($fullblock . '/db/install.xml')) {
                 $DB->get_manager()->install_from_xmldb_file($fullblock . '/db/install.xml'); //New method
             }
-            if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-                $DB->set_debug(false);
-            }
             $block->id = $DB->insert_record('block', $block);
             $blockobj->after_install();
             $component = 'block/'.$block->name;
@@ -1275,9 +1261,7 @@ function upgrade_blocks_plugins() {
             message_update_providers($component);
 
             notify(get_string('blocksuccess', '', $blocktitle), 'notifysuccess');
-            if (!defined('CLI_UPGRADE')|| !CLI_UPGRADE) {
-                echo '<hr />';
-            }
+            print_upgrade_separator();
         }
 
         $blocktitles[$block->name] = $blocktitle;
index f7520596ae2314315acab6802b65f12f06a5037d..c286782b627d21cd8c6012bb14ac01463ec15fde 100644 (file)
@@ -45,7 +45,8 @@ function xmldb_main_install($version) {
     $cat = get_course_category();
 
 
-    $defaults = array('auth'                  => 'email',
+    $defaults = array('rolesactive'           => '0',         // marks fully set up system
+                      'auth'                  => 'email',
                       'auth_pop3mailbox'      => 'INBOX',
                       'enrol'                 => 'manual',
                       'enrol_plugins_enabled' => 'manual',
index e054542ba2cf69758f2bd756c67069b87d910c8e..f2f0d3ee95b039ae409573869ed8723ae6874410 100644 (file)
@@ -37,14 +37,12 @@ function upgrade_fix_category_depths() {
                   FROM {course_categories} c, {course_categories} pc
                  WHERE c.parent=pc.id AND c.depth=0 AND pc.depth=?";
         if ($rs = $DB->get_recordset_sql($sql, array($parentdepth))) {
-            $DB->set_debug(false);
             foreach ($rs as $cat) {
                 $cat->depth = $parentdepth+1;
                 $cat->path  = $cat->path.'/'.$cat->id;
                 $DB->update_record('course_categories', $cat);
             }
             $rs->close();
-            $DB->set_debug(false);
         }
         $parentdepth++;
         if ($parentdepth > 100) {
@@ -68,8 +66,6 @@ function upgrade_migrate_files_courses() {
     $pbar = new progress_bar('migratecoursefiles', 500, true);
 
     $rs = $DB->get_recordset('course');
-    $olddebug = $DB->get_debug();
-    $DB->set_debug(false); // lower debug level, there might be many files
     $i = 0;
     foreach ($rs as $course) {
         $i++;
@@ -78,7 +74,6 @@ function upgrade_migrate_files_courses() {
         upgrade_migrate_files_course($context, '/', true);
         $pbar->update($i, $count, "Migrated course files - course $i/$count.");
     }
-    $DB->set_debug($olddebug); // reset debug level
     $rs->close();
 
     return true;
@@ -179,8 +174,6 @@ function upgrade_migrate_files_blog() {
 
         $pbar = new progress_bar('migrateblogfiles', 500, true);
 
-        $olddebug = $DB->get_debug();
-        $DB->set_debug(false); // lower debug level, there might be many files
         $i = 0;
         foreach ($rs as $entry) {
             $i++;
@@ -216,7 +209,6 @@ function upgrade_migrate_files_blog() {
             $DB->update_record('post', $entry);
             $pbar->update($i, $count, "Migrated blog attachments - $i/$count.");
         }
-        $DB->set_debug($olddebug); // reset debug level
         $rs->close();
     }
 
index 96121272557a48152891c5e033b5325b8bb844a6..7ac8ba71dec503aed3e0b9e112e53827160603bc 100644 (file)
@@ -141,10 +141,6 @@ class database_manager {
             throw new ddl_table_missing_exception($tablename);
         }
 
-    /// Do this function silenty (to avoid output in install/upgrade process)
-        $olddbdebug = $this->mdb->get_debug();
-        $this->mdb->set_debug(false);
-
         if (is_string($field)) {
             $fieldname = $field;
         } else {
@@ -157,9 +153,6 @@ class database_manager {
 
         $exists = array_key_exists($fieldname,  $columns);
 
-    /// Re-set original debug
-        $this->mdb->set_debug($olddbdebug);
-
         return $exists;
     }
 
@@ -180,10 +173,6 @@ class database_manager {
             throw new ddl_table_missing_exception($tablename);
         }
 
-    /// Do this function silenty (to avoid output in install/upgrade process)
-        $olddbdebug = $this->mdb->get_debug();
-        $this->mdb->set_debug(false);
-
     /// Extract index columns
         $indcolumns = $xmldb_index->getFields();
 
@@ -197,13 +186,11 @@ class database_manager {
             $diferences = array_merge(array_diff($columns, $indcolumns), array_diff($indcolumns, $columns));
         /// If no diferences, we have find the index
             if (empty($diferences)) {
-                $this->mdb->set_debug($olddbdebug);
                 return $indexname;
             }
         }
 
     /// Arriving here, index not found
-        $this->mdb->set_debug($olddbdebug);
         return false;
     }
 
@@ -243,10 +230,6 @@ class database_manager {
             throw new ddl_field_missing_exception($xmldb_field->getName(), $xmldb_table->getName());
         }
 
-    /// Do this function silenty (to avoid output in install/upgrade process)
-        $olddbdebug = $this->mdb->get_debug();
-        $this->mdb->set_debug(false);
-
     /// Get list of check_constraints in table/field
         $checks = false;
         if ($objchecks = $this->generator->getCheckConstraintsFromDB($xmldb_table, $xmldb_field)) {
@@ -258,7 +241,6 @@ class database_manager {
         }
 
     /// Arriving here, check not found
-        $this->mdb->set_debug($olddbdebug);
         return $checks;
     }
 
@@ -336,13 +318,8 @@ class database_manager {
 
         $sequencename = false;
 
-    /// Do this function silenty (to avoid output in install/upgrade process)
-        $olddbdebug = $this->mdb->get_debug();
-        $this->mdb->set_debug(false);
-
         $sequencename = $this->generator->getSequenceFromDB($xmldb_table);
 
-        $this->mdb->set_debug($olddbdebug);
         return $sequencename;
     }
 
@@ -441,16 +418,9 @@ class database_manager {
      */
     public function install_from_xmldb_structure($xmldb_structure) {
 
-        /// Do this function silenty (to avoid output in install/upgrade process)
-        $olddbdebug = $this->mdb->get_debug();
-        $this->mdb->set_debug(false);
-
         if (!$sqlarr = $this->generator->getCreateStructureSQL($xmldb_structure)) {
             return; // nothing to do
         }
-
-        $this->mdb->set_debug($olddbdebug);
-
         $this->execute_sql_arr($sqlarr);
     }
 
index 44f977ce297ba3432dbc012c5d9646e7973bc4a2..bdea4d9efc6af44d2aaf861aa2f78799bfe17db0 100644 (file)
@@ -166,10 +166,6 @@ abstract class sql_generator {
      * @return boolean true/false
      */
     public function table_exists($table, $temptable=false) {
-    /// Do this function silenty (to avoid output in install/upgrade process)
-        $olddbdebug = $this->mdb->get_debug();
-        $this->mdb->set_debug(false);
-
         if (is_string($table)) {
             $tablename = $table;
         } else {
@@ -181,9 +177,6 @@ abstract class sql_generator {
         $tables = $this->mdb->get_tables();
         $exists = in_array($tablename, $tables);
 
-    /// Re-set original debug
-        $this->mdb->set_debug($olddbdebug);
-
         return $exists;
     }
 
index 375c9977f3f8f5f5b15510a11d9d749ba5481135..42df368f0a6707a1c6159f36d5b18fbfa4039cd5 100644 (file)
@@ -134,16 +134,11 @@ function upgrade_local_db() {
         upgrade_log_start();
         require_once ($CFG->dirroot .'/local/db/upgrade.php');
 
-        if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-            $DB->set_debug(true);
-        }
         xmldb_local_upgrade($CFG->local_version);
-        if (!defined('CLI_UPGRADE') || !CLI_UPGRADE ) {
-            $DB->set_debug(false);
-        }
         set_config('local_version', $local_version);
         notify(get_string('databasesuccess'), 'notifysuccess');
         notify(get_string('databaseupgradelocal', '', $local_version), 'notifysuccess');
+        print_upgrade_separator();
 
         return true;
 
index 167ba81b5763f3e51867f504c5a7729e44805475..81fedf5f4a3cd51af2e896c758d769e9c3c0bb35 100644 (file)
@@ -54,8 +54,6 @@ function xmldb_assignment_upgrade($oldversion) {
 
             $pbar = new progress_bar('migrateassignmentfiles', 500, true);
 
-            $olddebug = $DB->get_debug();
-            $DB->set_debug(false); // lower debug level, there might be many files
             $i = 0;
             foreach ($rs as $submission) {
                 $i++;
@@ -127,7 +125,6 @@ function xmldb_assignment_upgrade($oldversion) {
                 @rmdir("$CFG->dataroot/$submission->course/$CFG->moddata/assignment/$submission->assignment");
                 @rmdir("$CFG->dataroot/$submission->course/$CFG->moddata/assignment");
             }
-            $DB->set_debug($olddebug); // reset debug level
             $rs->close();
 
         }
index c8d65126d933090e9e5df756f983bcf1afb738ea..8f08fc5f8b65d3f70314ae0fcc775ee672a512a6 100644 (file)
@@ -2254,8 +2254,6 @@ function assignment_upgrade_grades() {
              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) {
@@ -2264,7 +2262,6 @@ function assignment_upgrade_grades() {
             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 416a2ede7521574a1c5d94ae389e31ce284f839c..eccbde4de79bba3e4af24bebab2db127ad51dbb9 100644 (file)
@@ -94,8 +94,6 @@ function xmldb_data_upgrade($oldversion) {
 
             $pbar = new progress_bar('migratedatafiles', 500, true);
 
-            $olddebug = $DB->get_debug();
-            $DB->set_debug(false); // lower debug level, there might be very many files
             $i = 0;
             foreach ($rs as $content) {
                 $i++;
@@ -143,7 +141,6 @@ function xmldb_data_upgrade($oldversion) {
                 @rmdir("$CFG->dataroot/$content->course/$CFG->moddata/data");
                 @rmdir("$CFG->dataroot/$content->course/$CFG->moddata");
             }
-            $DB->set_debug($olddebug); // reset debug level
             $rs->close();
         }
         upgrade_mod_savepoint($result, 2008091400, 'data');
index 943902111ef5d598bcb6bdf9398b752ed5fe9349..0bfbfb40c43c3c6fc39a69fc609f4ef08452a456 100755 (executable)
@@ -848,8 +848,6 @@ function data_upgrade_grades() {
              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) {
@@ -858,7 +856,6 @@ function data_upgrade_grades() {
             data_update_grades($data, 0, false);
             $pbar->update($i, $count, "Updating Database grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }
index d5f13c1dd92a8cdd568e6dcd46ce09c9ee7b8357..07cb48cf2451054a2f885cda6601a8da31866b58 100644 (file)
@@ -53,12 +53,10 @@ function xmldb_forum_upgrade($oldversion) {
                  WHERE ra.id IS NULL";
 
         if ($rs = $DB->get_recordset_sql($sql, $params)) {
-            $DB->set_debug(false);
             foreach ($rs as $remove) {
                 $DB->delete_records('forum_subscriptions', array('userid'=>$remove->userid, 'forum'=>$remove->forumid));
                 echo '.';
             }
-            $DB->set_debug(true);
             $rs->close();
         }
 
@@ -118,8 +116,6 @@ function xmldb_forum_upgrade($oldversion) {
 
             $pbar = new progress_bar('migrateforumfiles', 500, true);
 
-            $olddebug = $DB->get_debug();
-            $DB->set_debug(false); // lower debug level, there might be very many files
             $i = 0;
             foreach ($rs as $post) {
                 $i++;
@@ -159,7 +155,6 @@ function xmldb_forum_upgrade($oldversion) {
                 @rmdir("$CFG->dataroot/$post->course/$CFG->moddata/forum/$post->forum");
                 @rmdir("$CFG->dataroot/$post->course/$CFG->moddata/forum");
             }
-            $DB->set_debug($olddebug); // reset debug level
             $rs->close();
         }
 
index 6376f7052b2827cf1a18d621a40c9efe1736a03f..f3eb8e49fa8205bc3f8c56c2b4c2ea0fd95ed3c6 100644 (file)
@@ -1485,9 +1485,6 @@ function forum_upgrade_grades() {
               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) {
@@ -1496,7 +1493,6 @@ function forum_upgrade_grades() {
             forum_update_grades($forum, 0, false);
             $pbar->update($i, $count, "Updating Forum grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }
index 790c0aa0901d523157bf3e20260f6ac180b46cba..9f6ae723d416864a3240c8377d32b563e98b3df0 100644 (file)
@@ -50,8 +50,6 @@ function xmldb_glossary_upgrade($oldversion) {
 
             $pbar = new progress_bar('migrateglossaryfiles', 500, true);
 
-            $olddebug = $DB->get_debug();
-            $DB->set_debug(false); // lower debug level, there might be very many files
             $i = 0;
             foreach ($rs as $entry) {
                 $i++;
@@ -96,7 +94,6 @@ function xmldb_glossary_upgrade($oldversion) {
                 @rmdir("$CFG->dataroot/$entry->course/$CFG->moddata/glossary/$entry->glossaryid");
                 @rmdir("$CFG->dataroot/$entry->course/$CFG->moddata/glossary");
             }
-            $DB->set_debug($olddebug); // reset debug level
             $rs->close();
         }
 
index 419c85ba6640aa6996432c159ffb293baee2e6d5..85024cf4a9d26b52d6bb91eaebec18ebcf196d98 100644 (file)
@@ -386,8 +386,6 @@ function glossary_upgrade_grades() {
               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) {
@@ -396,7 +394,6 @@ function glossary_upgrade_grades() {
             glossary_update_grades($glossary, 0, false);
             $pbar->update($i, $count, "Updating Glossary grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }
index 89d95702feae894dbb83f60fbe83f0e56c1bcc9e..cb6541bb1357db313211460b546dbf7a93bf1328 100644 (file)
@@ -1291,8 +1291,6 @@ function hotpot_upgrade_grades() {
         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) {
@@ -1301,7 +1299,6 @@ function hotpot_upgrade_grades() {
             hotpot_update_grades($hotpot, 0, false);
             $pbar->update($i, $count, "Updating Hotpot grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }
index 693d59cc6b193d534546ffa49826701544519e51..176c6e00fa259d6ee8dcbdc03bf9333b94a89fe6 100644 (file)
@@ -424,8 +424,6 @@ function lesson_upgrade_grades() {
               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) {
@@ -434,7 +432,6 @@ function lesson_upgrade_grades() {
             lesson_update_grades($lesson, 0, false);
             $pbar->update($i, $count, "Updating Lesson grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }
index 89dc61f9ffbefb61fcc9c5f76677c6e0c0826d5f..b5f57eeebdd34713fe19fc08c76cff6c80aabbcb 100644 (file)
@@ -390,8 +390,6 @@ function quiz_upgrade_grades() {
               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) {
@@ -400,7 +398,6 @@ function quiz_upgrade_grades() {
             quiz_update_grades($quiz, 0, false);
             $pbar->update($i, $count, "Updating Quiz grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }
index 03705f2c0c8f97a732eaf1fdfb009d123da9f5b6..aa6788f89903ba755662607bf933af83c85bc979 100644 (file)
@@ -186,8 +186,6 @@ function xmldb_scorm_upgrade($oldversion) {
 
             $pbar = new progress_bar('migratescormfiles', 500, true);
 
-            $olddebug = $DB->get_debug();
-            $DB->set_debug(false); // lower debug level, there might be many files
             $i = 0;
             foreach ($rs as $scorm) {
                 $i++;
@@ -226,7 +224,6 @@ function xmldb_scorm_upgrade($oldversion) {
                 @rmdir("$CFG->dataroot/$scorm->course/$CFG->moddata/scorm/");
                 @rmdir("$CFG->dataroot/$scorm->course/$CFG->moddata/");
             }
-            $DB->set_debug($olddebug); // reset debug level
             $rs->close();
         }
 
index 8247b1bd3b48279df51e6dc0d73f1f755907a936..3c0bd534b08fefe474e271b0158990ff8b2d3fb3 100755 (executable)
@@ -512,8 +512,6 @@ function scorm_upgrade_grades() {
               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) {
@@ -522,7 +520,6 @@ function scorm_upgrade_grades() {
             scorm_update_grades($scorm, 0, false);
             $pbar->update($i, $count, "Updating Scorm grades ($i/$count).");
         }
-        $DB->set_debug($prevdebug);
         $rs->close();
     }
 }