]> git.mjollnir.org Git - moodle.git/commitdiff
More robust when dealing with a plugin module that isn't readable
authormoodler <moodler>
Wed, 8 Jan 2003 09:07:07 +0000 (09:07 +0000)
committermoodler <moodler>
Wed, 8 Jan 2003 09:07:07 +0000 (09:07 +0000)
admin/index.php
lib/moodlelib.php

index 313935f0ccc0430e339f287172d415a22007dd7e..894be6c843afafdb0159c766f5d019a216f73f1e 100644 (file)
 
         unset($module);
 
-        include_once("$fullmod/version.php");  # defines $module with version etc
-        include_once("$fullmod/db/$CFG->dbtype.php");  # defines upgrading function
+        if ( is_readable("$fullmod/version.php")) {
+            include_once("$fullmod/version.php");  # defines $module with version etc
+        } else {
+            notify("Module $mod: $fullmod/version.php was not readable");
+            continue;
+        }
+
+        if ( is_readable("$fullmod/db/$CFG->dbtype.php")) {
+            include_once("$fullmod/db/$CFG->dbtype.php");  # defines upgrading function
+        } else {
+            notify("Module $mod: $fullmod/db/$CFG->dbtype.php was not readable");
+            continue;
+        }
+
 
         if (!isset($module)) {
             continue;
index f99ece13fa369aeb420e888dd8656031dd69193c..28824220c0f94ec3507f53174b44470cd185e4fc 100644 (file)
@@ -458,7 +458,11 @@ function get_moodle_cookie() {
 
     $cookiename = "MOODLEID{$CFG->prefix}"; 
 
-    return rc4decrypt($_COOKIE[$cookiename]);
+    if (empty($_COOKIE[$cookiename])) {
+        return "";
+    } else {
+        return rc4decrypt($_COOKIE[$cookiename]);
+    }
 }
 
 
@@ -1192,6 +1196,10 @@ function moodle_needs_upgrading() {
             foreach ($mods as $mod) {
                 $fullmod = "$CFG->dirroot/mod/$mod";
                 unset($module);
+                if (!is_readable("$fullmod/version.php")) {
+                    notify("Module '$mod' is not readable - check permissions");
+                    continue;
+                }
                 include_once("$fullmod/version.php");  # defines $module with version etc
                 if ($currmodule = get_record("modules", "name", $mod)) {
                     if ($module->version > $currmodule->version) {