Changeset 10100


Ignore:
Timestamp:
04/06/11 12:30:06 (9 years ago)
Author:
patdenice
Message:

feature:2250
Deactivate and uninstall obsolete plugins.

Location:
trunk/admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/plugins_list.php

    r10098 r10100  
    7070$plugins->get_merged_extensions(); 
    7171$plugins->get_incompatible_plugins(); 
    72 $merged_plugins = array(); 
     72$merged_plugins = false; 
    7373 
    7474foreach($plugins->fs_plugins as $plugin_id => $fs_plugin) 
     
    9393    ); 
    9494 
    95   if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions'])) 
    96   { 
    97     $tpl_plugin['STATE'] = 'merged'; 
    98     array_push($merged_plugins, $tpl_plugin); 
    99     continue; 
    100   } 
    101  
    10295  if (isset($plugins->db_plugins_by_id[$plugin_id])) 
    10396  { 
     
    109102  } 
    110103 
     104  if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions'])) 
     105  { 
     106    switch($tpl_plugin['STATE']) 
     107    { 
     108      case 'active': $plugins->perform_action('deactivate', $plugin_id); 
     109      case 'inactive': $plugins->perform_action('uninstall', $plugin_id); 
     110    } 
     111    $tpl_plugin['STATE'] = 'merged'; 
     112    $tpl_plugin['DESC'] = l10n("THIS PLUGIN IS NOW PART OF PIWIGO CORE. UNINSTALL IT NOW."); 
     113    $merged_plugins = true; 
     114  } 
     115 
    111116  $template->append('plugins', $tpl_plugin); 
    112117} 
     
    115120$template->append('plugin_states', 'inactive'); 
    116121$template->append('plugin_states', 'uninstalled'); 
     122 
     123if ($merged_plugins) 
     124{ 
     125  $template->append('plugin_states', 'merged'); 
     126} 
    117127 
    118128$missing_plugin_ids = array_diff( 
     
    139149} 
    140150 
    141 if (count($merged_plugins) > 0) 
    142 { 
    143   foreach($merged_plugins as $tpl_plugin) 
    144   { 
    145     $tpl_plugin['DESC'] = l10n("THIS PLUGIN IS NOW PART OF PIWIGO CORE. UNINSTALL IT NOW."); 
    146     $template->append('plugins', $tpl_plugin); 
    147   } 
    148   $template->append('plugin_states', 'merged'); 
    149 } 
    150  
    151151$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins'); 
    152152?> 
  • trunk/admin/themes/default/template/plugins_list.tpl

    r10098 r10100  
    5959          | <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> 
    6060 
    61     {elseif $plugin_state == 'missing' or $plugin_state == 'merged'} 
     61    {elseif $plugin_state == 'missing'} 
    6262          <a href="{$plugin.U_ACTION}&amp;action=uninstall" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> 
    6363 
     64    {elseif $plugin_state == 'merged'} 
     65          <a href="{$plugin.U_ACTION}&amp;action=delete">{'Delete'|@translate}</a> 
    6466    {/if} 
    6567        </td> 
Note: See TracChangeset for help on using the changeset viewer.