mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-13317 use cached system context in get_user_access_sitewide and when rebuilding paths; merged from MOODLE_19_STABLE
This commit is contained in:
parent
6a5dc27c18
commit
683ff270fe
@ -1232,8 +1232,8 @@ function get_user_access_sitewide($userid) {
|
||||
$accessdata['rdef'] = array();
|
||||
$accessdata['loaded'] = array();
|
||||
|
||||
$sitectx = get_field('context', 'id','contextlevel', CONTEXT_SYSTEM);
|
||||
$base = "/$sitectx";
|
||||
$sitectx = get_system_context();
|
||||
$base = '/'.$sitectx->id;
|
||||
|
||||
//
|
||||
// Role assignments - and any rolecaps directly linked
|
||||
@ -5181,15 +5181,9 @@ function build_context_path($force=false, $feedback=false) {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/ddllib.php');
|
||||
|
||||
// Site
|
||||
$sitectx = get_record('context', 'contextlevel', CONTEXT_SYSTEM);
|
||||
$base = '/' . $sitectx->id;
|
||||
|
||||
if ($force || $sitectx->path !== $base) {
|
||||
set_field('context', 'path', $base, 'id', $sitectx->id);
|
||||
set_field('context', 'depth', 1, 'id', $sitectx->id);
|
||||
$sitectx = get_record('context', 'contextlevel', CONTEXT_SYSTEM);
|
||||
}
|
||||
// System context
|
||||
$sitectx = get_system_context(!$force);
|
||||
$base = '/'.$sitectx->id;
|
||||
|
||||
// Sitecourse
|
||||
$sitecoursectx = get_record('context',
|
||||
|
Loading…
x
Reference in New Issue
Block a user