1
0

correct approach to detect installed plugins (#45)

This commit is contained in:
onli
2014-05-27 00:45:42 +02:00
parent 1fcdf783e5
commit bd100c1f4f

View File

@@ -345,9 +345,11 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
'install' => true); 'install' => true);
serendipity_plugin_api::hook_event('backend_plugins_fetchplugin', $fetchplugin_data); serendipity_plugin_api::hook_event('backend_plugins_fetchplugin', $fetchplugin_data);
// we now have to check that the plugin is not already installed or stackable to prevent invalid double instances // we now have to check that the plugin is not already installed, or stackable, to prevent invalid double instances
$existingPlugin =& serendipity_plugin_api::load_plugin($serendipity['GET']['install_plugin']);
$new_plugin = true; $new_plugin = true;
foreach (serendipity_plugin_api::get_installed_plugins() as $pluginName) {
if ($serendipity['GET']['install_plugin'] === $pluginName) {
$existingPlugin =& serendipity_plugin_api::load_plugin($serendipity['GET']['install_plugin']);
if (is_object($existingPlugin)) { if (is_object($existingPlugin)) {
$bag = new serendipity_property_bag(); $bag = new serendipity_property_bag();
$existingPlugin->introspect($bag); $existingPlugin->introspect($bag);
@@ -355,6 +357,10 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
$new_plugin = false; $new_plugin = false;
} }
} }
break;
}
}
$data['new_plugin_failed'] = ! $new_plugin; $data['new_plugin_failed'] = ! $new_plugin;
if ($fetchplugin_data['install'] && $new_plugin) { if ($fetchplugin_data['install'] && $new_plugin) {