MDL-14679 fixed some more $db's

This commit is contained in:
skodak
2008-05-31 22:18:41 +00:00
parent 98891b9348
commit fd0e6640cc
18 changed files with 29 additions and 33 deletions
@@ -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();
+8 -8
View File
@@ -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;
+1 -1
View File
@@ -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});
-1
View File
@@ -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
+1 -1
View File
@@ -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');
+1 -2
View File
@@ -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')) {
-1
View File
@@ -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.
*/
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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 = ',';
+1 -2
View File
@@ -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;
+1 -1
View File
@@ -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)) {
+1 -1
View File
@@ -34,7 +34,7 @@
function forum_restore_mods($mod,$restore) {
global $CFG,$db;
global $CFG,$DB;
$status = true;
+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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');
+3 -3
View File
@@ -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);
+1 -1
View File
@@ -25,7 +25,7 @@
function survey_restore_mods($mod,$restore) {
global $CFG,$db;
global $CFG,$DB;
$status = true;
+3 -3
View File
@@ -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 .= '<table border="0" width="90%" class="diagnosis">';
$o .= '<tr><td>DatabaseBackend</td><td>';
$o .= "<b>" . $db . "</b><br />";
if ($db == "files") {
$o .= "<b>" . $xdb . "</b><br />";
if ($xdb == "files") {
$o .= "<small>_DBFILES_DIR='</small><tt>" . EWIKI_DBFILES_DIRECTORY . "'</tt>";
if (strpos(EWIKI_DBFILES_DIRECTORY, "tmp")) {
$o .= "<br /><b>Warning</b>: 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.";
+3 -3
View File
@@ -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);
}