mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
More robust when dealing with a plugin module that isn't readable
This commit is contained in:
parent
4e080c888a
commit
1079c8a872
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user