static $allowed_contexts = array(CONTEXT_SYSTEM, CONTEXT_PERSONAL, CONTEXT_USER, CONTEXT_COURSECAT, CONTEXT_COURSE, CONTEXT_GROUP, CONTEXT_MODULE, CONTEXT_BLOCK);
// Yu: Separating site and site course context - removed CONTEXT_COURSE override when SITEID
+
+ // fix for MDL-9016
+ if ($contextlevel == 'clearcache') {
+ // Clear ALL cache
+ $context_cache = array();
+ $context_cache_id = array();
+ $CONTEXT = '';
+ return false;
+ }
/// If no level is supplied then return the current global context if there is one
if (empty($contextlevel)) {
if ($courseid != SITEID) {
delete_context(CONTEXT_COURSE, $course->id);
}
-
+
+ // fix for MDL-9016
+ // clear the cache because the course context is deleted, and
+ // we don't want to write assignment, overrides and context_rel table
+ // with this old context id!
+ get_context_instance('clearcache');
return $result;
}