fix for MDL-9016, clearing cache after deletion of course_content

This commit is contained in:
toyomoyo
2007-03-23 07:18:00 +00:00
parent 6e7cd09c2f
commit 250aa125bb
2 changed files with 15 additions and 1 deletions
+9
View File
@@ -1792,6 +1792,15 @@ function get_context_instance($contextlevel=NULL, $instance=0) {
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)) {
+6 -1
View File
@@ -3054,7 +3054,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;
}