]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12704 - Added error handling to print_recent_activity() to prevent fatal errors...
authormchurch <mchurch>
Fri, 28 Dec 2007 16:04:30 +0000 (16:04 +0000)
committermchurch <mchurch>
Fri, 28 Dec 2007 16:04:30 +0000 (16:04 +0000)
course/lib.php

index cadd68e961d67f16d541d1bd9038940adc169043..67c4662e733adbd61fe25427f9568dda56656aff 100644 (file)
@@ -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?
         }
     }