From fd0e6640cc4bc3bb3fcbf864fecef93ab802f302 Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 31 May 2008 22:18:41 +0000 Subject: [PATCH] MDL-14679 fixed some more $db's --- .../check_bigints/check_bigints.class.php | 2 +- backup/restorelib.php | 16 ++++++++-------- enrol/database/enrol.php | 2 +- lib/datalib.php | 1 - lib/environmentlib.php | 2 +- lib/locallib.php | 3 +-- mnet/xmlrpc/server.php | 1 - mod/assignment/lib.php | 2 +- mod/data/import.php | 2 +- mod/data/restorelib.php | 3 +-- mod/forum/lib.php | 2 +- mod/forum/restorelib.php | 2 +- mod/hotpot/lib.php | 2 +- mod/quiz/report/overview/report.php | 2 +- mod/survey/lib.php | 6 +++--- mod/survey/restorelib.php | 2 +- mod/wiki/ewiki/plugins/init.php | 6 +++--- search/indexlib.php | 6 +++--- 18 files changed, 29 insertions(+), 33 deletions(-) diff --git a/admin/xmldb/actions/check_bigints/check_bigints.class.php b/admin/xmldb/actions/check_bigints/check_bigints.class.php index 6cc2b220f6..8553d61b49 100644 --- a/admin/xmldb/actions/check_bigints/check_bigints.class.php +++ b/admin/xmldb/actions/check_bigints/check_bigints.class.php @@ -76,7 +76,7 @@ class check_bigints extends XMLDBAction { $this->does_generate = ACTION_GENERATE_HTML; /// These are always here - global $CFG, $XMLDB, $db, $DB; + global $CFG, $XMLDB, $DB; $dbman = $DB->get_manager(); $dbfamily = $DB->get_dbfamily(); diff --git a/backup/restorelib.php b/backup/restorelib.php index 60a7ed727b..ffa4471712 100644 --- a/backup/restorelib.php +++ b/backup/restorelib.php @@ -997,7 +997,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //in backup_ids when restoring in a existing course function restore_create_sections(&$restore, $xml_file) { - global $CFG,$db; + global $CFG; $status = true; //Check it exists @@ -1164,7 +1164,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //Called to set up any course-format specific data that may be in the file function restore_set_format_data($restore,$xml_file) { - global $CFG,$db; + global $CFG; $status = true; //Check it exists @@ -1202,7 +1202,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //about each incidence function restore_create_metacourse($restore,$xml_file) { - global $CFG,$db; + global $CFG; $status = true; //Check it exists @@ -2356,7 +2356,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //user_course_creators and user_admins from xml function restore_create_users($restore,$xml_file) { - global $CFG, $db; + global $CFG; require_once ($CFG->dirroot.'/tag/lib.php'); $status = true; @@ -3078,7 +3078,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //from xml function restore_create_questions($restore,$xml_file) { - global $CFG, $db; + global $CFG; $status = true; //Check it exists @@ -3106,7 +3106,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //This function creates all the scales function restore_create_scales($restore,$xml_file) { - global $CFG, $db; + global $CFG; $status = true; //Check it exists @@ -3499,7 +3499,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //This function creates all the course events function restore_create_events($restore,$xml_file) { - global $CFG, $db; + global $CFG; $status = true; //Check it exists @@ -3957,7 +3957,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3); //Depending what has been selected. function restore_create_logs($restore,$xml_file) { - global $CFG,$db; + global $CFG; //Number of records to get in every chunk $recordset_size = 4; diff --git a/enrol/database/enrol.php b/enrol/database/enrol.php index 01a816c2f4..92fd0462e2 100644 --- a/enrol/database/enrol.php +++ b/enrol/database/enrol.php @@ -37,7 +37,7 @@ function setup_enrolments(&$user) { /// Get the authoritative list of enrolments from the external database table /// We're using the ADOdb functions natively here and not our datalib functions - /// because we didn't want to mess with the $db global + /// because we didn't want to mess with the $ db global $useridfield = $enroldb->quote($user->{$CFG->enrol_localuserfield}); diff --git a/lib/datalib.php b/lib/datalib.php index 07820717b5..e5b67996f1 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1797,7 +1797,6 @@ function coursemodule_visible_for_user($cm, $userid=0) { * * @uses $CFG * @uses $USER - * @uses $db * @uses $REMOTE_ADDR * @uses SITEID * @param int $courseid The course id diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 71cd733fb4..e5ddcdacca 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -680,7 +680,7 @@ function environment_check_php($version) { * @return object results encapsulated in one environment_result object */ function environment_check_unicode($version) { - global $db, $DB; + global $DB; $result = new environment_results('unicode'); diff --git a/lib/locallib.php b/lib/locallib.php index 16ab63ba06..5488369aa0 100644 --- a/lib/locallib.php +++ b/lib/locallib.php @@ -112,12 +112,11 @@ * On success it prints a continue link. On failure it prints an error. * * @uses $CFG - * @uses $db to do something really evil with the debug setting that should probably be eliminated. TODO! * @param string $continueto a URL passed to print_continue() if the local upgrades succeed. */ function upgrade_local_db($continueto) { - global $CFG, $db; + global $CFG, $DB; // if we don't have code version or a db upgrade file, just return true, we're unneeded if (!file_exists($CFG->dirroot.'/local/version.php') || !file_exists($CFG->dirroot.'/local/db/upgrade.php')) { diff --git a/mnet/xmlrpc/server.php b/mnet/xmlrpc/server.php index b101ff028b..c21abaf598 100644 --- a/mnet/xmlrpc/server.php +++ b/mnet/xmlrpc/server.php @@ -116,7 +116,6 @@ $response = mnet_server_dispatch($payload); * | | * |________________________________________________| * - * @uses $db * @param string $HTTP_RAW_POST_DATA The XML that the client sent * @return string The XMLRPC payload. */ diff --git a/mod/assignment/lib.php b/mod/assignment/lib.php index 0b3cd7e6bd..ca1d18abb9 100644 --- a/mod/assignment/lib.php +++ b/mod/assignment/lib.php @@ -1005,7 +1005,7 @@ class assignment_base { * Display all the submissions ready for grading */ function display_submissions($message='') { - global $CFG, $db, $USER; + global $CFG, $DB, $USER; require_once($CFG->libdir.'/gradelib.php'); /* first we check to see if the form has just been submitted diff --git a/mod/data/import.php b/mod/data/import.php index bab4d385eb..63f24a699b 100755 --- a/mod/data/import.php +++ b/mod/data/import.php @@ -194,7 +194,7 @@ function my_file_get_contents($filename, $use_include_path = 0) { // Read the records from the given file. // Perform a simple field count check for each record. function data_get_records_csv($filename, $fielddelimiter=',', $fieldenclosure="\n") { - global $db; + global $DB; if (empty($fielddelimiter)) { $fielddelimiter = ','; diff --git a/mod/data/restorelib.php b/mod/data/restorelib.php index 0da5bf6731..9d0b7e1e6b 100644 --- a/mod/data/restorelib.php +++ b/mod/data/restorelib.php @@ -321,8 +321,7 @@ function data_content_restore_mods ($old_record_id, $new_record_id, $old_data_id function data_restore_files ($old_data_id, $new_data_id, $old_field_id, $new_field_id, $old_record_id, $new_record_id, $recinfo, $restore) { - - global $CFG, $db; + global $CFG, $DB; $status = true; $todo = false; diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 197c56871f..284cf87d48 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -6113,7 +6113,7 @@ function forum_tp_clean_read_records() { * Sets the last post for a given discussion **/ function forum_discussion_update_last_post($discussionid) { - global $CFG, $db; + global $CFG, $DB; // Check the given discussion exists if (!record_exists('forum_discussions', 'id', $discussionid)) { diff --git a/mod/forum/restorelib.php b/mod/forum/restorelib.php index ee7d177ddf..4494baa21c 100644 --- a/mod/forum/restorelib.php +++ b/mod/forum/restorelib.php @@ -34,7 +34,7 @@ function forum_restore_mods($mod,$restore) { - global $CFG,$db; + global $CFG,$DB; $status = true; diff --git a/mod/hotpot/lib.php b/mod/hotpot/lib.php index 0ac81b89a2..7208364b9b 100644 --- a/mod/hotpot/lib.php +++ b/mod/hotpot/lib.php @@ -1387,7 +1387,7 @@ function hotpot_scale_used_anywhere($scaleid) { function hotpot_add_attempt($hotpotid) { - global $db, $CFG, $USER; + global $DB, $CFG, $USER; // get start time of this attempt $time = time(); diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 2a47c3d757..eb93a46d9a 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -17,7 +17,7 @@ class quiz_report extends quiz_default_report { * Display the report. */ function display($quiz, $cm, $course) { - global $CFG, $db; + global $CFG, $DB; // Define some strings $strreallydel = addslashes(get_string('deleteattemptcheck','quiz')); $strtimeformat = get_string('strftimedatetime'); diff --git a/mod/survey/lib.php b/mod/survey/lib.php index d788b00c2e..a31ac87329 100644 --- a/mod/survey/lib.php +++ b/mod/survey/lib.php @@ -339,7 +339,7 @@ function survey_print_all_responses($cmid, $results, $courseid) { function survey_get_template_name($templateid) { - global $db; + global $DB; if ($templateid) { if ($ss = get_record("surveys", "id", $templateid)) { @@ -363,7 +363,7 @@ function survey_shorten_name ($name, $numwords) { function survey_print_multi($question) { - global $USER, $db, $qnum, $checklist; + global $USER, $DB, $qnum, $checklist; $stripreferthat = get_string("ipreferthat", "survey"); $strifoundthat = get_string("ifoundthat", "survey"); @@ -458,7 +458,7 @@ function survey_print_multi($question) { function survey_print_single($question) { - global $db, $qnum; + global $DB, $qnum; $rowclass = survey_question_rowclass(0); diff --git a/mod/survey/restorelib.php b/mod/survey/restorelib.php index 90525d53d7..25b02b16bc 100644 --- a/mod/survey/restorelib.php +++ b/mod/survey/restorelib.php @@ -25,7 +25,7 @@ function survey_restore_mods($mod,$restore) { - global $CFG,$db; + global $CFG,$DB; $status = true; diff --git a/mod/wiki/ewiki/plugins/init.php b/mod/wiki/ewiki/plugins/init.php index d518d71e7d..3d47b52d14 100644 --- a/mod/wiki/ewiki/plugins/init.php +++ b/mod/wiki/ewiki/plugins/init.php @@ -48,11 +48,11 @@ function ewiki_initialization_wizard($id, &$data, &$action) { #-- analyze and print settings and misconfigurations $pf_db = $ewiki_plugins["database"][0]; - $db = substr($pf_db, strrpos($pf_db, "_") + 1); + $xdb = substr($pf_db, strrpos($pf_db, "_") + 1); $o .= ''; $o .= '
DatabaseBackend'; - $o .= "" . $db . "
"; - if ($db == "files") { + $o .= "" . $xdb . "
"; + if ($xdb == "files") { $o .= "_DBFILES_DIR='" . EWIKI_DBFILES_DIRECTORY . "'"; if (strpos(EWIKI_DBFILES_DIRECTORY, "tmp")) { $o .= "
Warning: Storing your pages into a temporary directory is not what you want (there they would get deleted randomly), except for testing purposes of course. See the README."; diff --git a/search/indexlib.php b/search/indexlib.php index b107ec1a5a..8f76c47039 100644 --- a/search/indexlib.php +++ b/search/indexlib.php @@ -199,7 +199,7 @@ class IndexDBControl { * @deprecated Database is installed at install and should not be dropped out */ public function checkDB() { - global $CFG, $db; + global $CFG, $DB; $sqlfile = "{$CFG->dirroot}/search/db/$CFG->dbtype.sql"; $ret = false; @@ -222,7 +222,7 @@ class IndexDBControl { * @uses db, CFG */ public function addDocument($document=null) { - global $db, $CFG; + global $DB, $CFG; if ($document == null) { return false; @@ -251,7 +251,7 @@ class IndexDBControl { * @uses db */ public function delDocument($document) { - global $db; + global $DB; delete_records(SEARCH_DATABASE_TABLE, 'id', $document->dbid); } -- 2.39.5