mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
Only send contexts to cache if the aren't empty. At initial installations
some empty contexts were being cached and used later, causing insertion of null values to every DB but MySQL.
This commit is contained in:
parent
a13d2157f4
commit
ccfc5ecca1
@ -977,10 +977,11 @@ function get_context_instance($aggregatelevel=NULL, $instance=SITEID) {
|
||||
$context = get_record('context', 'aggregatelevel', $aggregatelevel, 'instanceid', $instance);
|
||||
}
|
||||
|
||||
/// Update the cache
|
||||
$context_cache[$aggregatelevel][$instance] = $context; // Cache it for later
|
||||
$context_cache_id[$context->id] = $context; // Cache it for later
|
||||
|
||||
/// Only add to cache if context isn't empty.
|
||||
if (!empty($context)) {
|
||||
$context_cache[$aggregatelevel][$instance] = $context; // Cache it for later
|
||||
$context_cache_id[$context->id] = $context; // Cache it for later
|
||||
}
|
||||
|
||||
return $context;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user