fix for MDL-9016, clearing context cache after remove_course_content()
This commit is contained in:
@@ -1521,6 +1521,15 @@ function get_context_instance($contextlevel=NULL, $instance=SITEID) {
|
||||
if ($contextlevel == CONTEXT_COURSE && $instance == SITEID) {
|
||||
$contextlevel = CONTEXT_SYSTEM;
|
||||
}
|
||||
|
||||
// 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)) {
|
||||
|
||||
+6
-1
@@ -2871,7 +2871,12 @@ function remove_course_contents($courseid, $showfeedback=true) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user