Changeset 11047


Ignore:
Timestamp:
05/25/11 12:54:59 (9 years ago)
Author:
patdenice
Message:

merge r11043 from branch 2.2 to trunk
feature:2250
Add obsolete_extensions.list file in install directory.
Incompatible plugins is checked through ajax.

Location:
trunk
Files:
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/plugins.class.php

    r10594 r11047  
    535535  function get_merged_extensions($version=PHPWG_VERSION) 
    536536  { 
    537     if (isset($_SESSION['merged_extensions']) and $_SESSION['merged_extensions']['~~expire~~'] > time()) 
    538     { 
    539       return $_SESSION['merged_extensions']; 
    540     } 
    541  
    542     $_SESSION['merged_extensions'] = array('~~expire~~' => time() + 600); 
    543  
    544     if (fetchRemote(PHPWG_URL.'/download/merged_extensions.txt', $result)) 
    545     { 
    546       $rows = explode("\n", $result); 
    547       foreach ($rows as $row) 
    548       { 
    549         if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match)) 
    550         { 
    551           if (version_compare($version, $match[1], '>=')) 
    552           { 
    553             $extensions = explode(',', trim($match[2])); 
    554             $_SESSION['merged_extensions'] = array_merge($_SESSION['merged_extensions'], $extensions); 
    555           } 
    556         } 
    557       } 
    558     } 
    559  
    560     return $_SESSION['merged_extensions']; 
     537    $file = PHPWG_ROOT_PATH.'install/obsolete_extensions.list'; 
     538    $merged_extensions = array(); 
     539 
     540    if (file_exists($file) and $obsolete_ext = file($file, FILE_IGNORE_NEW_LINES) and !empty($obsolete_ext)) 
     541    { 
     542      foreach ($obsolete_ext as $ext) 
     543      { 
     544        if (preg_match('/^(\d+) ?: ?(.*?)$/', $ext, $matches)) 
     545        { 
     546          $merged_extensions[$matches[1]] = $matches[2]; 
     547        } 
     548      } 
     549    } 
     550    return $merged_extensions; 
    561551  } 
    562552   
  • trunk/admin/plugins_installed.php

    r11010 r11047  
    6565} 
    6666 
     67//--------------------------------------------------------Incompatible Plugins 
     68if (isset($_GET['incompatible_plugins'])) 
     69{ 
     70  $incompatible_plugins = array(); 
     71  foreach ($plugins->get_incompatible_plugins() as $plugin => $version) 
     72  { 
     73    if ($plugin == '~~expire~~') continue; 
     74    array_push($incompatible_plugins, $plugin); 
     75     
     76  } 
     77  echo json_encode($incompatible_plugins); 
     78  exit; 
     79} 
     80 
    6781// +-----------------------------------------------------------------------+ 
    6882// |                     start template output                             | 
     
    7084 
    7185$plugins->sort_fs_plugins('name'); 
    72 $plugins->get_merged_extensions(); 
    73 $plugins->get_incompatible_plugins(); 
     86$merged_extensions = $plugins->get_merged_extensions(); 
    7487$merged_plugins = false; 
    7588$tpl_plugins = array(); 
     
    8194  { 
    8295    // Incompatible plugins must be reinitilized 
    83     $plugins->get_incompatible_plugins(true); 
     96    unset($_SESSION['incompatible_plugins']); 
    8497  } 
    8598 
     
    93106    'AUTHOR_URL' => @$fs_plugin['author uri'], 
    94107    'U_ACTION' => sprintf($action_url, $plugin_id), 
    95     'INCOMPATIBLE' => isset($_SESSION['incompatible_plugins'][$plugin_id]), 
    96108    ); 
    97109 
     
    105117  } 
    106118 
    107   if (isset($fs_plugin['extension']) and in_array($fs_plugin['extension'], $_SESSION['merged_extensions'])) 
     119  if (isset($fs_plugin['extension']) and isset($merged_extensions[$fs_plugin['extension']])) 
    108120  { 
    109121    $plugins->perform_action('uninstall', $plugin_id); 
  • trunk/admin/themes/default/template/plugins_list.tpl

    r11012 r11047  
    44/* incompatible message */ 
    55var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; 
    6 incompatible_msg += '\n'; 
    7 incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; 
     6var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; 
    87 
    98/* group action */ 
     
    4039  }; 
    4140 
    42   /* incompatible message */ 
    43   jQuery('.incompatible a.incompatible').click(function() { 
    44     return confirm(incompatible_msg); 
     41  /* incompatible plugins */ 
     42  jQuery(document).ready(function() { 
     43    jQuery.ajax({ 
     44      method: 'GET', 
     45      url: 'admin.php', 
     46      data: { page: 'plugins_installed', incompatible_plugins: true }, 
     47      dataType: 'json', 
     48      success: function(data) { 
     49        for (i=0;i<data.length;i++) { 
     50          {/literal} 
     51          {if $plugin_display == 'complete'} 
     52            jQuery('#'+data[i]+' .pluginBoxNameCell').prepend('<a class="warning" title="'+incompatible_msg+'"></a>') 
     53          {else} 
     54            jQuery('#'+data[i]+' .pluginMiniBoxNameCell').prepend('<span class="warning" title="'+incompatible_msg+'"></span>') 
     55          {/if} 
     56          {literal} 
     57          jQuery('#'+data[i]).addClass('incompatible'); 
     58          jQuery('#'+data[i]+' .activate').attr('onClick', 'return confirm(incompatible_msg + activate_msg);'); 
     59        } 
     60        jQuery('.warning').tipTip({ 
     61          'delay' : 0, 
     62          'fadeIn' : 200, 
     63          'fadeOut' : 200, 
     64          'maxWidth':'250px' 
     65        }); 
     66      } 
     67    }); 
    4568  }); 
    4669   
    4770  /* TipTips */ 
    48   jQuery('.warning').tipTip({ 
    49     'delay' : 0, 
    50     'fadeIn' : 200, 
    51     'fadeOut' : 200, 
    52     'maxWidth':'250px' 
    53   }); 
    5471  jQuery('.plugin-restore').tipTip({ 
    5572    'delay' : 0, 
     
    118135    
    119136  {if $plugin_display == 'complete'} 
    120     <div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}"> 
     137    <div id="{$plugin.ID}" class="pluginBox"> 
    121138      <table> 
    122139        <tr> 
    123140          <td class="pluginBoxNameCell"> 
    124             {if $plugin.INCOMPATIBLE}<a class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></a>{/if} 
    125141            {$plugin.NAME} 
    126142          </td> 
     
    134150 
    135151          {elseif $plugin.STATE == 'inactive'} 
    136             <a href="{$plugin.U_ACTION}&amp;action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> 
     152            <a href="{$plugin.U_ACTION}&amp;action=activate" class="activate">{'Activate'|@translate}</a> 
    137153            | <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> 
    138154 
     
    166182    {/if} 
    167183           
    168     <div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}"> 
     184    <div id="{$plugin.ID}" class="pluginMiniBox"> 
    169185      <div class="pluginMiniBoxNameCell"> 
    170         {if $plugin.INCOMPATIBLE}<span class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></span>{/if} 
    171186        {$plugin.NAME} 
    172187        <a class="showInfo" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$plugin.DESC|@escape:'html'}">i</a> 
     
    179194 
    180195        {elseif $plugin.STATE == 'inactive'} 
    181           <a href="{$plugin.U_ACTION}&amp;action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> 
     196          <a href="{$plugin.U_ACTION}&amp;action=activate" class="activate">{'Activate'|@translate}</a> 
    182197          | <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> 
    183198 
Note: See TracChangeset for help on using the changeset viewer.