diff --git a/admin/generator.php b/admin/generator.php index 0f764107d27b6..0e0c11e4b3513 100644 --- a/admin/generator.php +++ b/admin/generator.php @@ -387,10 +387,10 @@ public function generate_modules($courses) { .$this->get('number_of_modules')." modules in each section, for each course..."); list($modules_list_sql, $modules_params) = - $DB->get_in_or_equal($this->get('modules_list'), SQL_PARAMS_NAMED, 'param0000', true); + $DB->get_in_or_equal($this->get('modules_list'), SQL_PARAMS_NAMED, 'mod', true); list($modules_ignored_sql, $ignore_params) = - $DB->get_in_or_equal($this->modules_to_ignore, SQL_PARAMS_NAMED, 'param2000', false); + $DB->get_in_or_equal($this->modules_to_ignore, SQL_PARAMS_NAMED, 'ignore', false); $wheresql = "name $modules_list_sql AND name $modules_ignored_sql"; $modules = $DB->get_records_select('modules', $wheresql, array_merge($modules_params, $ignore_params)); diff --git a/admin/roles/lib.php b/admin/roles/lib.php index fc6e7d8bf9efe..3e9624eece2f2 100644 --- a/admin/roles/lib.php +++ b/admin/roles/lib.php @@ -1142,7 +1142,7 @@ public function find_users($search) { global $DB; list($wherecondition, $params) = $this->search_sql($search, 'u'); - list($ctxcondition, $ctxparams) = $DB->get_in_or_equal(get_parent_contexts($this->context, true), SQL_PARAMS_NAMED, 'ctx00'); + list($ctxcondition, $ctxparams) = $DB->get_in_or_equal(get_parent_contexts($this->context, true), SQL_PARAMS_NAMED, 'ctx'); $params = array_merge($params, $ctxparams); $params['roleid'] = $this->roleid; diff --git a/auth/db/auth.php b/auth/db/auth.php index 4f875b53239ef..566234f46386d 100644 --- a/auth/db/auth.php +++ b/auth/db/auth.php @@ -228,7 +228,7 @@ function sync_users($do_updates=false) { // find obsolete users if (count($userlist)) { - list($notin_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u0000', false); + list($notin_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u', false); $params['authtype'] = $this->authtype; $sql = "SELECT u.id, u.username, u.email, u.auth FROM {user} u @@ -290,7 +290,7 @@ function sync_users($do_updates=false) { // only go ahead if we actually // have fields to update locally if (!empty($updatekeys)) { - list($in_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u0000', true); + list($in_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u', true); $params['authtype'] = $this->authtype; $sql = "SELECT u.id, u.username FROM {user} u diff --git a/course/report/participation/index.php b/course/report/participation/index.php index 2ad66bb948aa5..659b198559f86 100644 --- a/course/report/participation/index.php +++ b/course/report/participation/index.php @@ -196,7 +196,7 @@ $actions = array_merge($viewnames, $postnames); } - list($actionsql, $params) = $DB->get_in_or_equal($actions, SQL_PARAMS_NAMED, 'action0'); + list($actionsql, $params) = $DB->get_in_or_equal($actions, SQL_PARAMS_NAMED, 'action'); $actionsql = "action $actionsql"; $relatedcontexts = get_related_contexts_string($context); diff --git a/enrol/category/locallib.php b/enrol/category/locallib.php index f2690bfa90523..bb53ecb0f07c4 100644 --- a/enrol/category/locallib.php +++ b/enrol/category/locallib.php @@ -111,7 +111,7 @@ public function role_unassigned($ra) { $params = array('courselevel'=>CONTEXT_COURSE, 'match'=>$parentcontext->path.'/%', 'userid'=>$ra->userid); $rs = $DB->get_recordset_sql($sql, $params); - list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r000'); + list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r'); $params['userid'] = $ra->userid; foreach ($rs as $instance) { @@ -119,7 +119,7 @@ public function role_unassigned($ra) { $contextids = get_parent_contexts($coursecontext); array_pop($contextids); // remove system context, we are interested in categories only - list($contextids, $contextparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'c000'); + list($contextids, $contextparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'c'); $params = array_merge($params, $contextparams); $sql = "SELECT ra.id @@ -168,8 +168,8 @@ function enrol_category_sync_course($course) { $contextids = get_parent_contexts($coursecontext); array_pop($contextids); // remove system context, we are interested in categories only - list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r000'); - list($contextids, $contextparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'c000'); + list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r'); + list($contextids, $contextparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'c'); $params = array_merge($params, $contextparams); $params['courseid'] = $course->id; @@ -257,7 +257,7 @@ function enrol_category_sync_full() { return; } - list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r000'); + list($roleids, $params) = $DB->get_in_or_equal(array_keys($roles), SQL_PARAMS_NAMED, 'r'); $params['courselevel'] = CONTEXT_COURSE; $params['catlevel'] = CONTEXT_COURSECAT; diff --git a/enrol/ldap/lib.php b/enrol/ldap/lib.php index 732708e54667c..492aa4d03949e 100644 --- a/enrol/ldap/lib.php +++ b/enrol/ldap/lib.php @@ -449,7 +449,7 @@ public function sync_enrolments() { WHERE u.deleted = 0 AND e.courseid = :courseid "; $params = array('roleid'=>$role->id, 'courseid'=>$course_obj->id); if (!empty($ldapmembers)) { - list($ldapml, $params2) = $DB->get_in_or_equal($ldapmembers, SQL_PARAMS_NAMED, 'm0', false); + list($ldapml, $params2) = $DB->get_in_or_equal($ldapmembers, SQL_PARAMS_NAMED, 'm', false); $sql .= "AND u.idnumber $ldapml"; $params = array_merge($params, $params2); unset($params2); diff --git a/enrol/locallib.php b/enrol/locallib.php index 448e6bc5d7653..5987691942977 100644 --- a/enrol/locallib.php +++ b/enrol/locallib.php @@ -141,7 +141,7 @@ public function get_total_users() { public function get_total_other_users() { global $DB; if ($this->totalotherusers === null) { - list($ctxcondition, $params) = $DB->get_in_or_equal(get_parent_contexts($this->context, true), SQL_PARAMS_NAMED, 'ctx00'); + list($ctxcondition, $params) = $DB->get_in_or_equal(get_parent_contexts($this->context, true), SQL_PARAMS_NAMED, 'ctx'); $params['courseid'] = $this->course->id; $sql = "SELECT COUNT(DISTINCT u.id) FROM {role_assignments} ra @@ -222,7 +222,7 @@ public function get_other_users($sort, $direction='ASC', $page=0, $perpage=25) { } $key = md5("$sort-$direction-$page-$perpage"); if (!array_key_exists($key, $this->otherusers)) { - list($ctxcondition, $params) = $DB->get_in_or_equal(get_parent_contexts($this->context, true), SQL_PARAMS_NAMED, 'ctx00'); + list($ctxcondition, $params) = $DB->get_in_or_equal(get_parent_contexts($this->context, true), SQL_PARAMS_NAMED, 'ctx'); $params['courseid'] = $this->course->id; $params['cid'] = $this->course->id; $sql = "SELECT ra.id as raid, ra.contextid, ra.component, ctx.contextlevel, ra.roleid, u.*, ue.lastseen diff --git a/enrol/meta/locallib.php b/enrol/meta/locallib.php index 066390f8552ae..5fa467ba18b53 100644 --- a/enrol/meta/locallib.php +++ b/enrol/meta/locallib.php @@ -208,7 +208,7 @@ function enrol_meta_sync($courseid = NULL) { // iterate through all not enrolled yet users if (enrol_is_enabled('meta')) { - list($enabled, $params) = $DB->get_in_or_equal(explode(',', $CFG->enrol_plugins_enabled), SQL_PARAMS_NAMED, 'e00'); + list($enabled, $params) = $DB->get_in_or_equal(explode(',', $CFG->enrol_plugins_enabled), SQL_PARAMS_NAMED, 'e'); $onecourse = ""; if ($courseid) { $params['courseid'] = $courseid; @@ -267,7 +267,7 @@ function enrol_meta_sync($courseid = NULL) { } $enabled[] = $DB->sql_empty(); // manual assignments are replicated too - list($enabled, $params) = $DB->get_in_or_equal($enabled, SQL_PARAMS_NAMED, 'e00'); + list($enabled, $params) = $DB->get_in_or_equal($enabled, SQL_PARAMS_NAMED, 'e'); $sql = "SELECT DISTINCT pra.roleid, pra.userid, c.id AS contextid, e.id AS enrolid FROM {role_assignments} pra JOIN {user} u ON (u.id = pra.userid AND u.deleted = 0) @@ -281,7 +281,7 @@ function enrol_meta_sync($courseid = NULL) { $params['courseid'] = $courseid; if ($ignored = $meta->get_config('nosyncroleids')) { - list($notignored, $xparams) = $DB->get_in_or_equal(explode(',', $ignored), SQL_PARAMS_NAMED, 'i00', false); + list($notignored, $xparams) = $DB->get_in_or_equal(explode(',', $ignored), SQL_PARAMS_NAMED, 'ig', false); $params = array_merge($params, $xparams); $sql = "$sql AND pra.roleid $notignored"; } @@ -296,7 +296,7 @@ function enrol_meta_sync($courseid = NULL) { // remove unwanted roles - include ignored roles and disabled plugins too $params = array('coursecontext' => CONTEXT_COURSE, 'courseid' => $courseid); if ($ignored = $meta->get_config('nosyncroleids')) { - list($notignored, $xparams) = $DB->get_in_or_equal(explode(',', $ignored), SQL_PARAMS_NAMED, 'i00', false); + list($notignored, $xparams) = $DB->get_in_or_equal(explode(',', $ignored), SQL_PARAMS_NAMED, 'ig', false); $params = array_merge($params, $xparams); $notignored = "AND pra.roleid $notignored"; } else { diff --git a/grade/import/lib.php b/grade/import/lib.php index 1209e1c33944e..3b1c7b02d30b6 100644 --- a/grade/import/lib.php +++ b/grade/import/lib.php @@ -164,7 +164,7 @@ function get_unenrolled_users_in_import($importcode, $courseid) { $relatedctxcondition = get_related_contexts_string(get_context_instance(CONTEXT_COURSE, $courseid)); //users with a gradeable role - list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr0'); + list($gradebookrolessql, $gradebookrolesparams) = $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr'); //enrolled users $context = get_context_instance(CONTEXT_COURSE, $courseid); diff --git a/grade/lib.php b/grade/lib.php index b8651a983e5c5..49d0c807172ef 100644 --- a/grade/lib.php +++ b/grade/lib.php @@ -89,7 +89,7 @@ public function init() { $relatedcontexts = get_related_contexts_string($coursecontext); list($gradebookroles_sql, $params) = - $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr0'); + $DB->get_in_or_equal(explode(',', $CFG->gradebookroles), SQL_PARAMS_NAMED, 'grbr'); //limit to users with an active enrolment list($enrolledsql, $enrolledparams) = get_enrolled_sql($coursecontext); @@ -144,7 +144,7 @@ public function init() { if (!empty($this->grade_items)) { $itemids = array_keys($this->grade_items); - list($itemidsql, $grades_params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED, 'items0'); + list($itemidsql, $grades_params) = $DB->get_in_or_equal($itemids, SQL_PARAMS_NAMED, 'items'); $params = array_merge($params, $grades_params); // $params contents: gradebookroles, enrolledparams, groupid (for $groupwheresql) and itemids @@ -2245,7 +2245,7 @@ public static function get_info_manage_settings($courseid) { */ public static function get_plugins_reports($courseid) { global $SITE; - + if (self::$gradereports !== null) { return self::$gradereports; } diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 4b5d23bc73d49..8554011a2aed1 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -391,7 +391,7 @@ public function load_users() { $this->users = array(); $this->userselect_params = array(); } else { - list($usql, $params) = $DB->get_in_or_equal(array_keys($this->users), SQL_PARAMS_NAMED, 'usid0'); + list($usql, $params) = $DB->get_in_or_equal(array_keys($this->users), SQL_PARAMS_NAMED, 'usid'); $this->userselect = "AND g.userid $usql"; $this->userselect_params = $params; } diff --git a/lib/accesslib.php b/lib/accesslib.php index 1b852e0a102fa..e4f31b9bf037b 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -2540,7 +2540,7 @@ function get_roles_with_capability($capability, $permission = null, $context = n if ($context) { $contexts = get_parent_contexts($context, true); - list($insql, $params) = $DB->get_in_or_equal($contexts, SQL_PARAMS_NAMED, 'ctx000'); + list($insql, $params) = $DB->get_in_or_equal($contexts, SQL_PARAMS_NAMED, 'ctx'); $contextsql = "AND rc.contextid $insql"; } else { $params = array(); @@ -3097,7 +3097,7 @@ function get_enrolled_sql($context, $withcapability = '', $groupid = 0, $onlyact // get all relevant capability info for all roles if ($withcapability) { - list($incontexts, $cparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'ctx00'); + list($incontexts, $cparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'ctx'); $cparams['cap'] = $withcapability; $defs = array(); @@ -3741,7 +3741,7 @@ function fetch_context_capabilities($context) { case CONTEXT_USER: $extracaps = array('moodle/grade:viewall'); - list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap0'); + list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap'); $SQL = "SELECT * FROM {capabilities} WHERE contextlevel = ".CONTEXT_USER." @@ -3814,7 +3814,7 @@ function fetch_context_capabilities($context) { $extra = ''; $extracaps = block_method_result($bi->blockname, 'get_extra_capabilities'); if ($extracaps) { - list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap0'); + list($extra, $params) = $DB->get_in_or_equal($extracaps, SQL_PARAMS_NAMED, 'cap'); $extra = "OR name $extra"; } @@ -4876,8 +4876,8 @@ function get_users_by_capability($context, $capability, $fields = '', $sort = '' // we need to find out all roles that have these capabilities either in definition or in overrides $defs = array(); - list($incontexts, $params) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'con000'); - list($incaps, $params2) = $DB->get_in_or_equal($caps, SQL_PARAMS_NAMED, 'cap000'); + list($incontexts, $params) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'con'); + list($incaps, $params2) = $DB->get_in_or_equal($caps, SQL_PARAMS_NAMED, 'cap'); $params = array_merge($params, $params2); $sql = "SELECT rc.id, rc.roleid, rc.permission, rc.capability, ctx.path FROM {role_capabilities} rc @@ -5001,7 +5001,7 @@ function get_users_by_capability($context, $capability, $fields = '', $sort = '' /// Groups if ($groups) { $groups = (array)$groups; - list($grouptest, $grpparams) = $DB->get_in_or_equal($groups, SQL_PARAMS_NAMED, 'grp000'); + list($grouptest, $grpparams) = $DB->get_in_or_equal($groups, SQL_PARAMS_NAMED, 'grp'); $grouptest = "u.id IN (SELECT userid FROM {groups_members} gm WHERE gm.groupid $grouptest)"; $params = array_merge($params, $grpparams); @@ -5016,7 +5016,7 @@ function get_users_by_capability($context, $capability, $fields = '', $sort = '' /// User exceptions if (!empty($exceptions)) { $exceptions = (array)$exceptions; - list($exsql, $exparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'exc000', false); + list($exsql, $exparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'exc', false); $params = array_merge($params, $exparams); $wherecond[] = "u.id $exsql"; } @@ -5538,7 +5538,7 @@ function user_has_role_assignment($userid, $roleid, $contextid = 0) { return false; } $parents = get_parent_contexts($context, true); - list($contexts, $params) = $DB->get_in_or_equal($parents, SQL_PARAMS_NAMED, 'r0000'); + list($contexts, $params) = $DB->get_in_or_equal($parents, SQL_PARAMS_NAMED, 'r'); $params['userid'] = $userid; $params['roleid'] = $roleid; diff --git a/lib/blocklib.php b/lib/blocklib.php index 20366580a01c0..d4a7d38db980c 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -533,13 +533,13 @@ public function load_blocks($includeinvisible = null) { $parentcontextids = get_parent_contexts($context); if ($parentcontextids) { list($parentcontexttest, $parentcontextparams) = - $DB->get_in_or_equal($parentcontextids, SQL_PARAMS_NAMED, 'parentcontext0000'); + $DB->get_in_or_equal($parentcontextids, SQL_PARAMS_NAMED, 'parentcontext'); $contexttest = "($contexttest OR (bi.showinsubcontexts = 1 AND bi.parentcontextid $parentcontexttest))"; } $pagetypepatterns = matching_page_type_patterns($this->page->pagetype); list($pagetypepatterntest, $pagetypepatternparams) = - $DB->get_in_or_equal($pagetypepatterns, SQL_PARAMS_NAMED, 'pagetypepatterntest0000'); + $DB->get_in_or_equal($pagetypepatterns, SQL_PARAMS_NAMED, 'pagetypepatterntest'); list($ccselect, $ccjoin) = context_instance_preload_sql('b.id', CONTEXT_BLOCK, 'ctx'); diff --git a/lib/datalib.php b/lib/datalib.php index 79a69e4fd9426..45ced890fcaa2 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -111,7 +111,7 @@ function search_users($courseid, $groupid, $searchtext, $sort='', array $excepti $fullname = $DB->sql_fullname('u.firstname', 'u.lastname'); if (!empty($exceptions)) { - list($exceptions, $params) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'ex0000', false); + list($exceptions, $params) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'ex', false); $except = "AND u.id $exceptions"; } else { $except = ""; @@ -210,7 +210,7 @@ function get_users($get=true, $search='', $confirmed=false, array $exceptions=nu } if ($exceptions) { - list($exceptions, $eparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'ex0000', false); + list($exceptions, $eparams) = $DB->get_in_or_equal($exceptions, SQL_PARAMS_NAMED, 'ex', false); $params = $params + $eparams; $except = " AND id $exceptions"; } diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index abdb815391256..6bfcff85aeee1 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -3037,7 +3037,7 @@ function xmldb_main_upgrade($oldversion) { } // add roles without archetypes, it may contain weird things, but we can not fix them - list($narsql, $params) = $DB->get_in_or_equal(array_keys($defaults), SQL_PARAMS_NAMED, 'ar000', false); + list($narsql, $params) = $DB->get_in_or_equal(array_keys($defaults), SQL_PARAMS_NAMED, 'ar', false); $sql = "SELECT DISTINCT ra.roleid, con.contextlevel FROM {role_assignments} ra JOIN {context} con ON ra.contextid = con.id @@ -4030,7 +4030,7 @@ function xmldb_main_upgrade($oldversion) { // enabled $enabledplugins = explode(',', $CFG->enrol_plugins_enabled); - list($sqlenabled, $params) = $DB->get_in_or_equal($enabledplugins, SQL_PARAMS_NAMED, 'ena00'); + list($sqlenabled, $params) = $DB->get_in_or_equal($enabledplugins, SQL_PARAMS_NAMED, 'ena'); $params['siteid'] = SITEID; $sql = "INSERT INTO {enrol} (enrol, status, courseid, sortorder, enrolperiod, enrolstartdate, enrolenddate, expirynotify, expirythreshold, notifyall, password, cost, currency, roleid, timecreated, timemodified) @@ -4042,7 +4042,7 @@ function xmldb_main_upgrade($oldversion) { WHERE c.id <> :siteid AND ra.enrol $sqlenabled"; $processed = $DB->get_fieldset_sql("SELECT DISTINCT enrol FROM {enrol}"); if ($processed) { - list($sqlnotprocessed, $params2) = $DB->get_in_or_equal($processed, SQL_PARAMS_NAMED, 'np00', false); + list($sqlnotprocessed, $params2) = $DB->get_in_or_equal($processed, SQL_PARAMS_NAMED, 'np', false); $params = array_merge($params, $params2); $sql = "$sql AND ra.enrol $sqlnotprocessed"; } @@ -4060,7 +4060,7 @@ function xmldb_main_upgrade($oldversion) { WHERE c.id <> :siteid"; $processed = $DB->get_fieldset_sql("SELECT DISTINCT enrol FROM {enrol}"); if ($processed) { - list($sqlnotprocessed, $params2) = $DB->get_in_or_equal($processed, SQL_PARAMS_NAMED, 'np00', false); + list($sqlnotprocessed, $params2) = $DB->get_in_or_equal($processed, SQL_PARAMS_NAMED, 'np', false); $params = array_merge($params, $params2); $sql = "$sql AND ra.enrol $sqlnotprocessed"; } @@ -4310,7 +4310,7 @@ function xmldb_main_upgrade($oldversion) { $params = array('syscontext'=>$syscontext->id, 'participate'=>'moodle/course:participate'); $roles = $DB->get_fieldset_sql("SELECT DISTINCT roleid FROM {role_capabilities} WHERE contextid = :syscontext AND capability = :participate AND permission = 1", $params); if ($roles) { - list($sqlroles, $params) = $DB->get_in_or_equal($roles, SQL_PARAMS_NAMED, 'r00'); + list($sqlroles, $params) = $DB->get_in_or_equal($roles, SQL_PARAMS_NAMED, 'r'); $sql = "INSERT INTO {user_enrolments} (status, enrolid, userid, timestart, timeend, modifierid, timecreated, timemodified) diff --git a/lib/enrollib.php b/lib/enrollib.php index 1bb1ca36a197e..fc0e49a95590d 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -244,7 +244,7 @@ function enrol_sharing_course($user1, $user2) { return false; } - list($plugins, $params) = $DB->get_in_or_equal($plugins, SQL_PARAMS_NAMED, 'ee00'); + list($plugins, $params) = $DB->get_in_or_equal($plugins, SQL_PARAMS_NAMED, 'ee'); $params['enabled'] = ENROL_INSTANCE_ENABLED; $params['active1'] = ENROL_USER_ACTIVE; $params['active2'] = ENROL_USER_ACTIVE; diff --git a/lib/gradelib.php b/lib/gradelib.php index f85d41b633252..c9793f1c71e81 100644 --- a/lib/gradelib.php +++ b/lib/gradelib.php @@ -208,7 +208,7 @@ function grade_update($source, $courseid, $itemtype, $itemmodule, $iteminstance, $count = count($grades); if ($count > 0 and $count < 200) { - list($uids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED, $start='uid0'); + list($uids, $params) = $DB->get_in_or_equal(array_keys($grades), SQL_PARAMS_NAMED, $start='uid'); $params['gid'] = $grade_item->id; $sql = "SELECT * FROM {grade_grades} WHERE itemid = :gid AND userid $uids"; diff --git a/lib/statslib.php b/lib/statslib.php index 8a499176ffd12..e57e89a07fc0a 100644 --- a/lib/statslib.php +++ b/lib/statslib.php @@ -378,8 +378,8 @@ function stats_cron_daily($maxdays=1) { /// individual user stats (including not-logged-in) in each course, this is slow - reuse this data if possible - list($viewactionssql, $params1) = $DB->get_in_or_equal($viewactions, SQL_PARAMS_NAMED, 'view000'); - list($postactionssql, $params2) = $DB->get_in_or_equal($postactions, SQL_PARAMS_NAMED, 'post000'); + list($viewactionssql, $params1) = $DB->get_in_or_equal($viewactions, SQL_PARAMS_NAMED, 'view'); + list($postactionssql, $params2) = $DB->get_in_or_equal($postactions, SQL_PARAMS_NAMED, 'post'); $sql = "INSERT INTO {stats_user_daily} (stattype, timeend, courseid, userid, statsreads, statswrites) SELECT 'activity' AS stattype, $nextmidnight AS timeend, d.courseid, d.userid, diff --git a/mnet/service/enrol/locallib.php b/mnet/service/enrol/locallib.php index ffe7e6de116df..c54ea2d083a58 100644 --- a/mnet/service/enrol/locallib.php +++ b/mnet/service/enrol/locallib.php @@ -336,7 +336,7 @@ public function req_course_enrolments($mnethostid, $remotecourseid) { if (empty($list)) { $DB->delete_records('mnetservice_enrol_enrolments', array('hostid'=>$mnethostid, 'remotecourseid'=>$remotecourseid)); } else { - list($isql, $params) = $DB->get_in_or_equal(array_keys($list), SQL_PARAMS_NAMED, 'param0000', false); + list($isql, $params) = $DB->get_in_or_equal(array_keys($list), SQL_PARAMS_NAMED, 'param', false); $params['hostid'] = $mnethostid; $params['remotecourseid'] = $remotecourseid; $select = "hostid = :hostid AND remotecourseid = :remotecourseid AND id $isql"; @@ -556,7 +556,7 @@ public function find_users($search) { return array(); } - list($usql, $uparams) = $DB->get_in_or_equal(array_keys($userids), SQL_PARAMS_NAMED, 'uid0000'); + list($usql, $uparams) = $DB->get_in_or_equal(array_keys($userids), SQL_PARAMS_NAMED, 'uid'); list($wherecondition, $params) = $this->search_sql($search, 'u'); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index a2ef362c1af29..fa05e85a20475 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -1939,7 +1939,7 @@ function forum_search_posts($searchterms, $courseid=0, $limitfrom=0, $limitnum=5 if ($forum->type == 'qanda' && !has_capability('mod/forum:viewqandawithoutposting', $context)) { if (!empty($forum->onlydiscussions)) { - list($discussionid_sql, $discussionid_params) = $DB->get_in_or_equal($forum->onlydiscussions, SQL_PARAMS_NAMED, 'qanda'.$forumid.'_0000'); + list($discussionid_sql, $discussionid_params) = $DB->get_in_or_equal($forum->onlydiscussions, SQL_PARAMS_NAMED, 'qanda'.$forumid.'_'); $params = array_merge($params, $discussionid_params); $select[] = "(d.id $discussionid_sql OR p.parent = 0)"; } else { @@ -1948,7 +1948,7 @@ function forum_search_posts($searchterms, $courseid=0, $limitfrom=0, $limitnum=5 } if (!empty($forum->onlygroups)) { - list($groupid_sql, $groupid_params) = $DB->get_in_or_equal($forum->onlygroups, SQL_PARAMS_NAMED, 'grps'.$forumid.'_0000'); + list($groupid_sql, $groupid_params) = $DB->get_in_or_equal($forum->onlygroups, SQL_PARAMS_NAMED, 'grps'.$forumid.'_'); $params = array_merge($params, $groupid_params); $select[] = "d.groupid $groupid_sql"; } @@ -1963,7 +1963,7 @@ function forum_search_posts($searchterms, $courseid=0, $limitfrom=0, $limitnum=5 } if ($fullaccess) { - list($fullid_sql, $fullid_params) = $DB->get_in_or_equal($fullaccess, SQL_PARAMS_NAMED, 'fula0'); + list($fullid_sql, $fullid_params) = $DB->get_in_or_equal($fullaccess, SQL_PARAMS_NAMED, 'fula'); $params = array_merge($params, $fullid_params); $where[] = "(d.forum $fullid_sql)"; } diff --git a/mod/glossary/sql.php b/mod/glossary/sql.php index 6298f8039b3af..43b7904e3a31f 100644 --- a/mod/glossary/sql.php +++ b/mod/glossary/sql.php @@ -241,7 +241,7 @@ if ($hook == 'SPECIAL') { //Create appropiate IN contents $alphabet = explode(",", get_string('alphabet', 'langconfig')); - list($nia, $aparams) = $DB->get_in_or_equal($alphabet, SQL_PARAMS_NAMED, $start='a0', false); + list($nia, $aparams) = $DB->get_in_or_equal($alphabet, SQL_PARAMS_NAMED, $start='a', false); $params = array_merge($params, $aparams); $where = "AND " . $DB->sql_substr("upper(concept)", 1, 1) . " $nia"; } diff --git a/mod/quiz/report/overview/report.php b/mod/quiz/report/overview/report.php index 767e31cd967b8..386c052d33e02 100644 --- a/mod/quiz/report/overview/report.php +++ b/mod/quiz/report/overview/report.php @@ -245,19 +245,19 @@ function display($quiz, $cm, $course) { break; case QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH: // Show only students with attempts - list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000'); + list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u'); $params += $allowed_params; $where = "u.id $allowed_usql AND qa.preview = 0 AND qa.id IS NOT NULL"; break; case QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO: // Show only students without attempts - list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000'); + list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u'); $params += $allowed_params; $where = "u.id $allowed_usql AND qa.id IS NULL"; break; case QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS: // Show all students with or without attempts - list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000'); + list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u'); $params += $allowed_params; $where = "u.id $allowed_usql AND (qa.preview = 0 OR qa.preview IS NULL)"; break; diff --git a/mod/quiz/report/responses/report.php b/mod/quiz/report/responses/report.php index 02914c7490d85..b296fd681858b 100644 --- a/mod/quiz/report/responses/report.php +++ b/mod/quiz/report/responses/report.php @@ -234,19 +234,19 @@ function display($quiz, $cm, $course) { break; case QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH: // Show only students with attempts - list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000'); + list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u'); $params += $allowed_params; $where = "u.id $allowed_usql AND qa.preview = 0 AND qa.id IS NOT NULL"; break; case QUIZ_REPORT_ATTEMPTS_STUDENTS_WITH_NO: // Show only students without attempts - list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000'); + list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u'); $params += $allowed_params; $where = "u.id $allowed_usql AND qa.id IS NULL"; break; case QUIZ_REPORT_ATTEMPTS_ALL_STUDENTS: // Show all students with or without attempts - list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u0000'); + list($allowed_usql, $allowed_params) = $DB->get_in_or_equal($allowed, SQL_PARAMS_NAMED, 'u'); $params += $allowed_params; $where = "u.id $allowed_usql AND (qa.preview = 0 OR qa.preview IS NULL)"; break; diff --git a/mod/quiz/report/statistics/qstats.php b/mod/quiz/report/statistics/qstats.php index cb2e05e775723..60db1a7c25e1c 100644 --- a/mod/quiz/report/statistics/qstats.php +++ b/mod/quiz/report/statistics/qstats.php @@ -38,7 +38,7 @@ function stats_init_object(){ } function get_records($quizid, $currentgroup, $groupstudents, $allattempts){ global $DB; - list($qsql, $qparams) = $DB->get_in_or_equal(array_keys($this->questions), SQL_PARAMS_NAMED, 'q0000'); + list($qsql, $qparams) = $DB->get_in_or_equal(array_keys($this->questions), SQL_PARAMS_NAMED, 'q'); list($fromqa, $whereqa, $qaparams) = quiz_report_attempts_sql($quizid, $currentgroup, $groupstudents, $allattempts); $sql = 'SELECT qs.id, ' . 'qs.question, ' . diff --git a/mod/quiz/report/statistics/report.php b/mod/quiz/report/statistics/report.php index 2ff7d64e3d97e..3ba19b0e66e79 100644 --- a/mod/quiz/report/statistics/report.php +++ b/mod/quiz/report/statistics/report.php @@ -659,7 +659,7 @@ function quiz_report_attempts_sql($quizid, $currentgroup, $groupstudents, $allat $whereqa = 'qa.quiz = :quizid AND qa.preview=0 AND qa.timefinish !=0 '; $qaparams = array('quizid'=>$quizid); if (!empty($currentgroup) && $groupstudents) { - list($grpsql, $grpparams) = $DB->get_in_or_equal(array_keys($groupstudents), SQL_PARAMS_NAMED, 'u0000'); + list($grpsql, $grpparams) = $DB->get_in_or_equal(array_keys($groupstudents), SQL_PARAMS_NAMED, 'u'); $whereqa .= 'AND qa.userid '.$grpsql.' '; $qaparams += $grpparams; } diff --git a/question/editlib.php b/question/editlib.php index b07ad7551c03d..6e75c60967b51 100644 --- a/question/editlib.php +++ b/question/editlib.php @@ -1047,7 +1047,7 @@ protected function build_query_sql($category, $recurse, $showhidden) { } else { $categoryids = array($category->id); } - list($catidtest, $params) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED, 'cat0000'); + list($catidtest, $params) = $DB->get_in_or_equal($categoryids, SQL_PARAMS_NAMED, 'cat'); $tests[] = 'q.category ' . $catidtest; $this->sqlparams = $params; diff --git a/repository/lib.php b/repository/lib.php index 545d1d1fd08fb..70c58d6947b18 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -653,7 +653,7 @@ public static function get_instances($args = array()) { WHERE i.typeid = r.id "; if (!empty($args['disable_types']) && is_array($args['disable_types'])) { - list($types, $p) = $DB->get_in_or_equal($args['disable_types'], SQL_PARAMS_QM, 'param0000', false); + list($types, $p) = $DB->get_in_or_equal($args['disable_types'], SQL_PARAMS_QM, 'param', false); $sql .= " AND r.type $types"; $params = array_merge($params, $p); } diff --git a/search/add.php b/search/add.php index 5f047827d9b64..8543215a56978 100644 --- a/search/add.php +++ b/search/add.php @@ -14,7 +14,7 @@ * * Major chages in this review is passing the xxxx_db_names return to * multiple arity to handle multiple document types modules - * + * * changes are in implementing new $DB access */ @@ -114,7 +114,7 @@ $docIds = $DB->get_records_sql_menu($query, array($mod->name)); if (!empty($docIds)){ - list($usql, $params) = $DB->get_in_or_equal(array_keys($docIds), SQL_PARAMS_QM, 'param0000', false); // negative IN + list($usql, $params) = $DB->get_in_or_equal(array_keys($docIds), SQL_PARAMS_QM, 'param', false); // negative IN $query = " SELECT id, $values[0] as docid diff --git a/search/delete.php b/search/delete.php index 605dcfd959b27..972a96122b8f7 100644 --- a/search/delete.php +++ b/search/delete.php @@ -15,7 +15,7 @@ * Major chages in this review is passing the xxxx_db_names return to * multiple arity to handle multiple document types modules */ - + /** * includes and requires */ @@ -24,15 +24,15 @@ if (!defined('MOODLE_INTERNAL')) { die('Direct access to this script is forbidden.'); /// It must be included from the cron script } - + global $DB; -/// makes inclusions of the Zend Engine more reliable +/// makes inclusions of the Zend Engine more reliable ini_set('include_path', $CFG->dirroot.DIRECTORY_SEPARATOR.'search'.PATH_SEPARATOR.ini_get('include_path')); require_once($CFG->dirroot.'/search/lib.php'); - require_once($CFG->dirroot.'/search/indexlib.php'); - + require_once($CFG->dirroot.'/search/indexlib.php'); + /// checks global search activation // require_login(); @@ -57,23 +57,23 @@ $dbcontrol = new IndexDBControl(); $deletion_count = 0; $startcleantime = time(); - + mtrace('Starting clean-up of removed records...'); mtrace('Index size before: '.$CFG->search_index_size."\n"); - + /// check all modules if ($mods = search_collect_searchables(false, true)){ - + foreach ($mods as $mod) { //build function names $class_file = $CFG->dirroot.'/search/documents/'.$mod->name.'_document.php'; $delete_function = $mod->name.'_delete'; $db_names_function = $mod->name.'_db_names'; $deletions = array(); - + if (file_exists($class_file)) { require_once($class_file); - + //if both required functions exist if (function_exists($delete_function) and function_exists($db_names_function)) { mtrace("Checking $mod->name module for deletions."); @@ -83,26 +83,26 @@ $where = (!empty($values[5])) ? 'WHERE '.$values[5] : ''; $itemtypes = ($values[4] != '*' && $values[4] != 'any') ? " itemtype = '{$values[4]}' AND " : '' ; $query = " - SELECT + SELECT id, {$values[0]} - FROM + FROM {{$values[1]}} $where "; $docIds = $DB->get_records_sql($query, array()); - + if (!empty($docIds)){ $table = SEARCH_DATABASE_TABLE; - list($usql, $params) = $DB->get_in_or_equal(array_keys($docIds), SQL_PARAMS_QM, 'param0000', false); // negative IN + list($usql, $params) = $DB->get_in_or_equal(array_keys($docIds), SQL_PARAMS_QM, 'param', false); // negative IN $query = " - SELECT - id, - docid - FROM + SELECT + id, + docid + FROM {{$table}} - WHERE - doctype = '{$mod->name}' AND + WHERE + doctype = '{$mod->name}' AND $itemtypes docid $usql "; @@ -110,24 +110,24 @@ } else { $records = array(); } - + // build an array of all the deleted records foreach($records as $record) { $deletions[] = $delete_function($record->docid, $values[4]); } } - + foreach ($deletions as $delete) { // find the specific document in the index, using it's docid and doctype as keys // change from default text only search to include numerals for this search. Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive()); $doc = $index->find("+docid:{$delete->id} +doctype:$mod->name +itemtype:{$delete->itemtype}"); - + // get the record, should only be one foreach ($doc as $thisdoc) { ++$deletion_count; mtrace(" Delete: $thisdoc->title (database id = $thisdoc->dbid, index id = $thisdoc->id, moodle instance id = $thisdoc->docid)"); - + //remove it from index and database table $dbcontrol->delDocument($thisdoc); $index->delete($thisdoc->id); @@ -142,16 +142,16 @@ } } } - + /// commit changes $index->commit(); - + /// update index date and index size set_config('search_indexer_cleanup_date', $startcleantime); set_config('search_index_size', (int)$CFG->search_index_size - (int)$deletion_count); - + mtrace("Finished $deletion_count removals."); mtrace('Index size after: '.$index->count()); diff --git a/user/selector/lib.php b/user/selector/lib.php index 0aba4e37483c0..f45686bee03ea 100644 --- a/user/selector/lib.php +++ b/user/selector/lib.php @@ -451,14 +451,14 @@ protected function search_sql($search, $u) { // If we are being asked to exclude any users, do that. if (!empty($this->exclude)) { - list($usertest, $userparams) = $DB->get_in_or_equal($this->exclude, SQL_PARAMS_NAMED, 'ex000', false); + list($usertest, $userparams) = $DB->get_in_or_equal($this->exclude, SQL_PARAMS_NAMED, 'ex', false); $tests[] = $u . 'id ' . $usertest; $params = array_merge($params, $userparams); } // If we are validating a set list of userids, add an id IN (...) test. if (!empty($this->validatinguserids)) { - list($usertest, $userparams) = $DB->get_in_or_equal($this->validatinguserids, SQL_PARAMS_NAMED, 'val000'); + list($usertest, $userparams) = $DB->get_in_or_equal($this->validatinguserids, SQL_PARAMS_NAMED, 'val'); $tests[] = $u . 'id ' . $usertest; $params = array_merge($params, $userparams); } @@ -756,7 +756,7 @@ public function print_user_summaries($courseid) { $usergroups = array(); $potentialmembersids = $this->potentialmembersids; if( empty($potentialmembersids)==false ) { - list($membersidsclause, $params) = $DB->get_in_or_equal($potentialmembersids, SQL_PARAMS_NAMED, 'pm0'); + list($membersidsclause, $params) = $DB->get_in_or_equal($potentialmembersids, SQL_PARAMS_NAMED, 'pm'); $sql = "SELECT u.id AS userid, g.* FROM {user} u JOIN {groups_members} gm ON u.id = gm.userid @@ -792,7 +792,7 @@ public function find_users($search) { // Get list of allowed roles. $context = get_context_instance(CONTEXT_COURSE, $this->courseid); if ($validroleids = groups_get_possible_roles($context)) { - list($roleids, $roleparams) = $DB->get_in_or_equal($validroleids, SQL_PARAMS_NAMED, 'r00'); + list($roleids, $roleparams) = $DB->get_in_or_equal($validroleids, SQL_PARAMS_NAMED, 'r'); } else { $roleids = " = -1"; $roleparams = array();