correct approach to detect installed plugins (#45)
This commit is contained in:
@@ -345,16 +345,22 @@ 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;
|
||||||
if (is_object($existingPlugin)) {
|
foreach (serendipity_plugin_api::get_installed_plugins() as $pluginName) {
|
||||||
$bag = new serendipity_property_bag();
|
if ($serendipity['GET']['install_plugin'] === $pluginName) {
|
||||||
$existingPlugin->introspect($bag);
|
$existingPlugin =& serendipity_plugin_api::load_plugin($serendipity['GET']['install_plugin']);
|
||||||
if ($bag->get('stackable') != true) {
|
if (is_object($existingPlugin)) {
|
||||||
$new_plugin = false;
|
$bag = new serendipity_property_bag();
|
||||||
|
$existingPlugin->introspect($bag);
|
||||||
|
if ($bag->get('stackable') != true) {
|
||||||
|
$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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user