Ignore:
Timestamp:
Apr 6, 2011, 12:30:06 PM (13 years ago)
Author:
patdenice
Message:

feature:2250
Deactivate and uninstall obsolete plugins.

File:
1 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?>
Note: See TracChangeset for help on using the changeset viewer.