Permalink
Browse files

MDL-27148 use new get_in_or_equal() param prefix instead of start

  • Loading branch information...
1 parent c49bec3 commit cf717dc26b40b42b295d6b48399a23dbec7b6c55 @skodak skodak committed Apr 14, 2011
View
@@ -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));
View
@@ -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;
View
@@ -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
@@ -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);
@@ -111,15 +111,15 @@ 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) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $instance->courseid);
$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;
View
@@ -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);
View
@@ -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
View
@@ -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 {
View
@@ -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);
View
@@ -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;
}
@@ -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;
}
View
@@ -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;
View
@@ -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');
View
@@ -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";
}
Oops, something went wrong.

0 comments on commit cf717dc

Please sign in to comment.