From: skodak Date: Sat, 23 Feb 2008 18:42:00 +0000 (+0000) Subject: MDL-13613 added better detection for outdated course modinfo; merged from MOODLE_19_S... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a6af674a9957346f0f50625a8d4ad00765eccbbd;p=moodle.git MDL-13613 added better detection for outdated course modinfo; merged from MOODLE_19_STABLE --- diff --git a/course/view.php b/course/view.php index 384b3b8264..4539d9c633 100644 --- a/course/view.php +++ b/course/view.php @@ -48,7 +48,7 @@ role_switch($switchrole, $context); } - require_login($course->id); + require_login($course); // Switchrole - sanity check in cost-order... if ($switchrole > 0 && confirm_sesskey() && @@ -186,8 +186,16 @@ // Course wrapper start. echo '
'; - $modinfo =& get_fast_modinfo($course); + $modinfo =& get_fast_modinfo($COURSE); get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused); + foreach($mods as $modid=>$unused) { + if (!isset($modinfo->cms[$modid])) { + rebuild_course_cache($course->id); + $modinfo =& get_fast_modinfo($COURSE); + debugging('Rebuilding course cache', DEBUG_DEVELOPER); + break; + } + } if (! $sections = get_all_sections($course->id)) { // No sections found // Double-check to be extra sure