diff --git a/lib/dmllib.php b/lib/dmllib.php index 9385f563fb3..9644a1ee965 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -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