]> git.mjollnir.org Git - moodle.git/commitdiff
Adding some serious checks to make Moodle break when there is any
authormoodler <moodler>
Sun, 1 Oct 2006 09:16:49 +0000 (09:16 +0000)
committermoodler <moodler>
Sun, 1 Oct 2006 09:16:49 +0000 (09:16 +0000)
select, insert or update on user_students, user_teachers, user_coursecreators,
or user_admins (once roles is installed), because they should not be used
at all and we will drop them soon.

lib/dmllib.php

index 9385f563fb33defd9362d9a036ed4a26e29dee84..9644a1ee96558aa2795f432a4da998c429d262d5 100644 (file)
@@ -607,6 +607,18 @@ function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) {
         return false;
     }
 
+/// Temporary hack as part of phasing out all access to obsolete user tables  XXX
+    if (!empty($CFG->rolesactive)) {
+        if (strpos($sql, $CFG->prefix.'user_students') || 
+            strpos($sql, $CFG->prefix.'user_teachers') ||
+            strpos($sql, $CFG->prefix.'user_coursecreators') ||
+            strpos($sql, $CFG->prefix.'user_admins')) {
+            if (debugging()) { var_dump(debug_backtrace()); }
+            error('This SQL relies on obsolete tables!  Your code must be fixed by a developer.');
+        }
+    }
+
+
     if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++; };
 
     if ($limitfrom || $limitnum) {
@@ -1051,6 +1063,14 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') {
         return false;
     }
 
+/// Temporary hack as part of phasing out all access to obsolete user tables  XXX
+    if (!empty($CFG->rolesactive)) {
+        if (in_array($table, array('user_students', 'user_teachers', 'user_coursecreators', 'user_admins'))) {
+            if (debugging()) { var_dump(debug_backtrace()); }
+            error('This SQL relies on obsolete tables ('.$table.')!  Your code must be fixed by a developer.');
+        }
+    }
+
     if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++; };
 
 /// In Moodle we always use auto-numbering fields for the primary key
@@ -1168,6 +1188,14 @@ function update_record($table, $dataobject) {
         return false;
     }
 
+/// Temporary hack as part of phasing out all access to obsolete user tables  XXX
+    if (!empty($CFG->rolesactive)) {
+        if (in_array($table, array('user_students', 'user_teachers', 'user_coursecreators', 'user_admins'))) {
+            if (debugging()) { var_dump(debug_backtrace()); }
+            error('This SQL relies on obsolete tables ('.$table.')!  Your code must be fixed by a developer.');
+        }
+    }
+
 /// Begin DIRTY HACK
     if ($CFG->dbtype == 'oci8po') {
         oracle_dirty_hack($table, $dataobject); // Convert object to the correct "empty" values for Oracle DB