correct approach to detect installed plugins (#45)
This commit is contained in:
parent
1fcdf783e5
commit
bd100c1f4f
@ -345,16 +345,22 @@ if (isset($_GET['serendipity']['plugin_to_conf'])) {
|
||||
'install' => true);
|
||||
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
|
||||
$existingPlugin =& serendipity_plugin_api::load_plugin($serendipity['GET']['install_plugin']);
|
||||
// we now have to check that the plugin is not already installed, or stackable, to prevent invalid double instances
|
||||
$new_plugin = true;
|
||||
if (is_object($existingPlugin)) {
|
||||
$bag = new serendipity_property_bag();
|
||||
$existingPlugin->introspect($bag);
|
||||
if ($bag->get('stackable') != true) {
|
||||
$new_plugin = false;
|
||||
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)) {
|
||||
$bag = new serendipity_property_bag();
|
||||
$existingPlugin->introspect($bag);
|
||||
if ($bag->get('stackable') != true) {
|
||||
$new_plugin = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$data['new_plugin_failed'] = ! $new_plugin;
|
||||
|
||||
if ($fetchplugin_data['install'] && $new_plugin) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user