Prevent api to install unstackable plugins twice (#45)
This commit is contained in:
parent
6d6570e92c
commit
1fcdf783e5
@ -4,6 +4,9 @@
|
|||||||
Version 2.0-beta3 ()
|
Version 2.0-beta3 ()
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
|
|
||||||
|
* Prevent "new" plugin api to install double instances of plugins
|
||||||
|
that are not stackable (issue #45)
|
||||||
|
|
||||||
* Back button in plugin-config
|
* Back button in plugin-config
|
||||||
|
|
||||||
* Adapted serendipity_editor.js to provide more global (though
|
* Adapted serendipity_editor.js to provide more global (though
|
||||||
|
@ -345,7 +345,19 @@ 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);
|
||||||
|
|
||||||
if ($fetchplugin_data['install']) {
|
// 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;
|
||||||
|
if (is_object($existingPlugin)) {
|
||||||
|
$bag = new serendipity_property_bag();
|
||||||
|
$existingPlugin->introspect($bag);
|
||||||
|
if ($bag->get('stackable') != true) {
|
||||||
|
$new_plugin = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data['new_plugin_failed'] = ! $new_plugin;
|
||||||
|
|
||||||
|
if ($fetchplugin_data['install'] && $new_plugin) {
|
||||||
$serendipity['debug']['pluginload'] = array();
|
$serendipity['debug']['pluginload'] = array();
|
||||||
$inst = serendipity_plugin_api::create_plugin_instance($serendipity['GET']['install_plugin'], null, (serendipity_plugin_api::is_event_plugin($serendipity['GET']['install_plugin']) ? 'event': 'right'), $authorid, serendipity_db_escape_string($serendipity['GET']['pluginPath']));
|
$inst = serendipity_plugin_api::create_plugin_instance($serendipity['GET']['install_plugin'], null, (serendipity_plugin_api::is_event_plugin($serendipity['GET']['install_plugin']) ? 'event': 'right'), $authorid, serendipity_db_escape_string($serendipity['GET']['pluginPath']));
|
||||||
|
|
||||||
|
@ -146,6 +146,9 @@
|
|||||||
{if $save}
|
{if $save}
|
||||||
<span class="msg_success"><span class="icon-ok-circled"></span> {$CONST.DONE}:{$CONST.SETTINGS_SAVED_AT|sprintf:"$timestamp"}</span>
|
<span class="msg_success"><span class="icon-ok-circled"></span> {$CONST.DONE}:{$CONST.SETTINGS_SAVED_AT|sprintf:"$timestamp"}</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
{if $new_plugin_failed}
|
||||||
|
<span class="msg_error"><span class="icon-attention-circled"></span> {$CONST.ERROR}: Plugin not stackable and already installed</span> {* i18n *}
|
||||||
|
{/if}
|
||||||
<script src="{serendipity_getFile file="admin/js/jquery.autoscroll.js"}"></script>
|
<script src="{serendipity_getFile file="admin/js/jquery.autoscroll.js"}"></script>
|
||||||
<script src="{serendipity_getFile file="admin/js/jquery.sortable.js"}"></script>
|
<script src="{serendipity_getFile file="admin/js/jquery.sortable.js"}"></script>
|
||||||
<script src="{serendipity_getFile file="admin/js/dragdrop.js"}"></script>
|
<script src="{serendipity_getFile file="admin/js/dragdrop.js"}"></script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user