MDL-22054 skip loading of missing modules
authorPetr Skoda <skodak@moodle.org>
Sun, 11 Apr 2010 08:59:27 +0000 (08:59 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 11 Apr 2010 08:59:27 +0000 (08:59 +0000)
admin/settings/plugins.php
lib/moodlelib.php

index 3c97d2e..d28af5d 100644 (file)
@@ -11,6 +11,9 @@ if ($hassiteconfig) {
         $modulebyname = array();
 
         foreach ($modules as $module) {
+            if (!file_exists("$CFG->dirroot/mod/$module->name/lib.php")) {
+                continue;
+            }
             $strmodulename = get_string('modulename', $module->name);
             // Deal with modules which are lacking the language string
             if ($strmodulename == '[[modulename]]') {
index bd8d343..f04aad3 100644 (file)
@@ -2825,6 +2825,10 @@ function &get_fast_modinfo(&$course, $userid=0) {
                 $minimalmodinfo=new stdClass();
                 $minimalmodinfo->cms=array();
                 foreach($info as $mod) {
+                    if (empty($mod->name)) {
+                        // something is wrong here
+                        continue;
+                    }
                     $minimalcm = new stdClass();
                     $minimalcm->id = $mod->cm;
                     $minimalcm->name = $mod->name;