feature:2250
Deactivate and uninstall obsolete plugins. git-svn-id: http://piwigo.org/svn/trunk@10100 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
0dd800150b
commit
566acba5a5
2 changed files with 21 additions and 19 deletions
|
|
@ -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');
|
||||
?>
|
||||
|
|
@ -58,9 +58,11 @@ jQuery(document).ready(function() {
|
|||
<a href="{$plugin.U_ACTION}&action=install">{'Install'|@translate}</a>
|
||||
| <a href="{$plugin.U_ACTION}&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}&action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a>
|
||||
|
||||
{elseif $plugin_state == 'merged'}
|
||||
<a href="{$plugin.U_ACTION}&action=delete">{'Delete'|@translate}</a>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue