fix for MDL-9016, clearing context cache after remove_course_content()

This commit is contained in:
toyomoyo
2007-03-23 07:20:16 +00:00
parent 3dfb5e4379
commit b36064f742
2 changed files with 15 additions and 1 deletions
+9
View File
@@ -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
View File
@@ -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;
}