From: mchurch Date: Fri, 28 Dec 2007 16:04:30 +0000 (+0000) Subject: MDL-12704 - Added error handling to print_recent_activity() to prevent fatal errors... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=296c6ac2326e2c76da40c21f800bc98ca2dce0e7;p=moodle.git MDL-12704 - Added error handling to print_recent_activity() to prevent fatal errors in the case of missing files. --- diff --git a/course/lib.php b/course/lib.php index cadd68e961..67c4662e73 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1131,23 +1131,27 @@ function print_recent_activity($course) { $viewfullnames = has_capability('moodle/site:viewfullnames', $context); foreach ($mods as $mod) { // Each module gets it's own logs and prints them - include_once($CFG->dirroot.'/mod/'.$mod->name.'/lib.php'); - $print_recent_activity = $mod->name.'_print_recent_activity'; - if (function_exists($print_recent_activity)) { - // - // NOTE: - // $isteacher (second parameter below) is to be deprecated! - // - // TODO: - // 1) Make sure that all _print_recent_activity functions are - // not using the $isteacher value. - // 2) Eventually, remove the $isteacher parameter from the - // function calls. - // - $modcontent = $print_recent_activity($course, $viewfullnames, $timestart); - if ($modcontent) { - $content = true; + if (file_exists($CFG->dirroot.'/mod/'.$mod->name.'/lib.php')) { + include_once($CFG->dirroot.'/mod/'.$mod->name.'/lib.php'); + $print_recent_activity = $mod->name.'_print_recent_activity'; + if (function_exists($print_recent_activity)) { + // + // NOTE: + // $isteacher (second parameter below) is to be deprecated! + // + // TODO: + // 1) Make sure that all _print_recent_activity functions are + // not using the $isteacher value. + // 2) Eventually, remove the $isteacher parameter from the + // function calls. + // + $modcontent = $print_recent_activity($course, $viewfullnames, $timestart); + if ($modcontent) { + $content = true; + } } + } else { + /// Really need to indicate an error here to admins. Is there a way to do this? } }