Commit cce9293b authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge changes I682fa270,I8b0e1d7e

* changes:
  Add check for missing plugins after upgrade (bug #629209)
  Print error to screen on plugins page when an installed plugin is missing (bug #629209)
parents 71935fe8 6085f741
......@@ -55,7 +55,13 @@ foreach (array_keys($plugins) as $plugin) {
if ($plugin == 'blocktype') {
$key = blocktype_single_to_namespaced($i->name, $i->artefactplugin);
}
safe_require($plugin, $key);
try {
safe_require($plugin, $key);
}
catch (SystemException $e) {
$message = get_string('missingplugin', 'admin', hsc("$plugin:$key")) . ':<br>' . $e->getMessage();
die_info($message);
}
$plugins[$plugin]['installed'][$key] = array(
'active' => $i->active,
'disableable' => call_static_method(generate_class_name($plugin, $key), 'can_be_disabled'),
......
......@@ -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;
}
?>
......@@ -118,6 +118,9 @@ $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