More robust when dealing with a plugin module that isn't readable

This commit is contained in:
moodler 2003-01-08 09:07:07 +00:00
parent 4e080c888a
commit 1079c8a872
2 changed files with 23 additions and 3 deletions

View File

@ -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;

View 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) {