Adding some serious checks to make Moodle break when there is any
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user