Commit a1970027 authored by Robert Lyon's avatar Robert Lyon

Bug 1752389: Undefined property: stdClass::$name on upgrade

This is when plugins are out of sync and the plugin doesn't have
$config->name defined

We should fall back to the plugin path as the name

behatnotneeded

Change-Id: I6bb64e785c0d3e12d77b681a34379f70865eaa28
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 5b686926
......@@ -197,7 +197,7 @@ function check_upgrades($name=null) {
}
}
}
$outofsyncplugins = array();
foreach ($plugins as $plugin) {
$plugintype = $plugin[0];
$pluginname = $plugin[1];
......@@ -309,7 +309,7 @@ function check_upgrades($name=null) {
$toupgrade[$pluginkey] = $plugininfo;
}
else if ($config->version < $pluginversion) {
$plugindisplayname = !empty($plugindisplayname) ? $plugindisplayname : $config->name;
$plugindisplayname = !empty($plugindisplayname) ? $plugindisplayname : (!empty($config->name) ? $config->name : $pluginpath);
if (get_config('productionmode')) {
throw new ConfigSanityException("Database version of Mahara plugin " . $plugindisplayname . " "
. $pluginrelease . " (" . $pluginversion . ") is newer "
......@@ -317,13 +317,15 @@ function check_upgrades($name=null) {
. "Please make sure you have the correct Mahara plugin files in place.");
}
else {
define('SITEOUTOFSYNC', $plugindisplayname);
$outofsyncplugins[] = $plugindisplayname;
}
}
}
if (!empty($outofsyncplugins)) {
define('SITEOUTOFSYNC', implode(', ', $outofsyncplugins));
}
// if we've just asked for one, don't return an array...
if (!empty($name)){
if (!empty($name)) {
if (count($toupgrade) == 1) {
$upgrade = new StdClass;
$upgrade->name = $name;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment