From 1079c8a87293fe6e35dc64b832ead563d0658951 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 8 Jan 2003 09:07:07 +0000 Subject: [PATCH] More robust when dealing with a plugin module that isn't readable --- admin/index.php | 16 ++++++++++++++-- lib/moodlelib.php | 10 +++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/admin/index.php b/admin/index.php index 313935f0cc..894be6c843 100644 --- a/admin/index.php +++ b/admin/index.php @@ -155,8 +155,20 @@ 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; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index f99ece13fa..28824220c0 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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) { -- 2.39.5