Merge branch 'MDL-32462_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE
This commit is contained in:
+16
-4
@@ -5853,12 +5853,24 @@ class context_user extends context {
|
||||
protected static function build_paths($force) {
|
||||
global $DB;
|
||||
|
||||
// first update normal users
|
||||
// First update normal users.
|
||||
$path = $DB->sql_concat('?', 'id');
|
||||
$pathstart = '/' . SYSCONTEXTID . '/';
|
||||
$params = array($pathstart);
|
||||
|
||||
if ($force) {
|
||||
$where = "depth <> 2 OR path IS NULL OR path <> ({$path})";
|
||||
$params[] = $pathstart;
|
||||
} else {
|
||||
$where = "depth = 0 OR path IS NULL";
|
||||
}
|
||||
|
||||
$sql = "UPDATE {context}
|
||||
SET depth = 2,
|
||||
path = ".$DB->sql_concat("'/".SYSCONTEXTID."/'", 'id')."
|
||||
WHERE contextlevel=".CONTEXT_USER;
|
||||
$DB->execute($sql);
|
||||
path = {$path}
|
||||
WHERE contextlevel = " . CONTEXT_USER . "
|
||||
AND ($where)";
|
||||
$DB->execute($sql, $params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user