Commit 6085f741 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add check for missing plugins after upgrade (bug #629209)



Change-Id: I682fa270f25cda2a257b42fd19124a9e98aa801c
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 63c45034
......@@ -32,6 +32,16 @@ define('INSTALLER', 1);
require(dirname(dirname(__FILE__)).'/init.php');
require(get_config('libroot') . 'upgrade.php');
if (param_integer('finished', 0)) {
if ($missing = check_installed_plugins()) {
$message = get_string('installedpluginsmissing', 'admin') . ': ';
$message .= join(', ', $missing) . '.';
$message .= ' ' . get_string('ensurepluginsexist', 'admin', get_config('docroot'));
$SESSION->add_error_msg($message);
}
redirect();
}
$smarty = smarty();
$upgrades = check_upgrades();
......@@ -164,6 +174,26 @@ if (isset($upgrades['core'])) {
}
$smarty->display('admin/upgrade.tpl');
function check_installed_plugins() {
$missing = array();
foreach (plugin_types() as $plugintype) {
if ($installed = plugins_installed($plugintype, true)) {
foreach ($installed as $i) {
$key = $i->name;
if ($plugintype == 'blocktype') {
$key = blocktype_single_to_namespaced($i->name, $i->artefactplugin);
}
try {
safe_require($plugintype, $key);
}
catch (SystemException $e) {
$missing[] = "$plugintype:$key";
}
}
}
}
return $missing;
}
?>
......@@ -119,6 +119,8 @@ $string['institutionfilesdescription'] = 'Upload and manage files for use in Ins
$string['pluginadmin'] = 'Plugin Administration';
$string['pluginadmindescription'] = 'Install and configure plugins';
$string['missingplugin'] = 'An installed plugin (%s) could not be found';
$string['installedpluginsmissing'] = 'The following plugins are installed but can no longer be found';
$string['ensurepluginsexist'] = 'Please make sure all your installed plugins are available under %s, and readable by the webserver.';
$string['htmlfilters'] = 'HTML Filters';
$string['htmlfiltersdescription'] = 'Enable new filters for HTML Purifier';
......
......@@ -26,6 +26,6 @@
{/foreach}
</tbody>
</table>
<div id="finished" class="nojs-hidden-block">{str section=admin tag=successfullyinstalled} <a href="{$WWWROOT}">{str section=admin tag=continue}</a></div>
<div id="finished" class="nojs-hidden-block">{str section=admin tag=successfullyinstalled} <a href="{$WWWROOT}admin/upgrade.php?finished=1">{str section=admin tag=continue}</a></div>
{include file='admin/upgradefooter.tpl'}
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