aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-06 10:30:06 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-06 10:30:06 +0000
commit566acba5a55a406193d87a962b2fbc7d03c20e1b (patch)
tree060be4c70a8b1cb5dbf1daf7b21e42fcc7582dd5 /admin
parent0dd800150b5e8aaeb229f45779c590db0658b1e9 (diff)
feature:2250
Deactivate and uninstall obsolete plugins. git-svn-id: http://piwigo.org/svn/trunk@10100 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/plugins_list.php36
-rw-r--r--admin/themes/default/template/plugins_list.tpl4
2 files changed, 21 insertions, 19 deletions
diff --git a/admin/plugins_list.php b/admin/plugins_list.php
index 6fee091e7..8ba89bb97 100644
--- a/admin/plugins_list.php
+++ b/admin/plugins_list.php
@@ -69,7 +69,7 @@ $plugins->set_tabsheet($page['page']);
$plugins->sort_fs_plugins('name');
$plugins->get_merged_extensions();
$plugins->get_incompatible_plugins();
-$merged_plugins = array();
+$merged_plugins = false;
foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
{
@@ -92,13 +92,6 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]),
);
- if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
- {
- $tpl_plugin['STATE'] = 'merged';
- array_push($merged_plugins, $tpl_plugin);
- continue;
- }
-
if (isset($plugins->db_plugins_by_id[$plugin_id]))
{
$tpl_plugin['STATE'] = $plugins->db_plugins_by_id[$plugin_id]['state'];
@@ -108,6 +101,18 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$tpl_plugin['STATE'] = 'uninstalled';
}
+ if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions']))
+ {
+ switch($tpl_plugin['STATE'])
+ {
+ case 'active': $plugins->perform_action('deactivate', $plugin_id);
+ case 'inactive': $plugins->perform_action('uninstall', $plugin_id);
+ }
+ $tpl_plugin['STATE'] = 'merged';
+ $tpl_plugin['DESC'] = l10n("THIS PLUGIN IS NOW PART OF PIWIGO CORE. UNINSTALL IT NOW.");
+ $merged_plugins = true;
+ }
+
$template->append('plugins', $tpl_plugin);
}
@@ -115,6 +120,11 @@ $template->append('plugin_states', 'active');
$template->append('plugin_states', 'inactive');
$template->append('plugin_states', 'uninstalled');
+if ($merged_plugins)
+{
+ $template->append('plugin_states', 'merged');
+}
+
$missing_plugin_ids = array_diff(
array_keys($plugins->db_plugins_by_id),
array_keys($plugins->fs_plugins)
@@ -138,15 +148,5 @@ if (count($missing_plugin_ids) > 0)
$template->append('plugin_states', 'missing');
}
-if (count($merged_plugins) > 0)
-{
- foreach($merged_plugins as $tpl_plugin)
- {
- $tpl_plugin['DESC'] = l10n("THIS PLUGIN IS NOW PART OF PIWIGO CORE. UNINSTALL IT NOW.");
- $template->append('plugins', $tpl_plugin);
- }
- $template->append('plugin_states', 'merged');
-}
-
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
?> \ No newline at end of file
diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl
index c1a3a3696..19931a3bb 100644
--- a/admin/themes/default/template/plugins_list.tpl
+++ b/admin/themes/default/template/plugins_list.tpl
@@ -58,9 +58,11 @@ jQuery(document).ready(function() {
<a href="{$plugin.U_ACTION}&amp;action=install">{'Install'|@translate}</a>
| <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm('{'Are you sure you want to delete this plugin?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a>
- {elseif $plugin_state == 'missing' or $plugin_state == 'merged'}
+ {elseif $plugin_state == 'missing'}
<a href="{$plugin.U_ACTION}&amp;action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a>
+ {elseif $plugin_state == 'merged'}
+ <a href="{$plugin.U_ACTION}&amp;action=delete">{'Delete'|@translate}</a>
{/if}
</td>
<td>