Changeset 10038


Ignore:
Timestamp:
Apr 4, 2011, 4:14:15 PM (14 years ago)
Author:
patdenice
Message:

Check merged extensions.

Location:
extensions/autoupdate/branches/2.0
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/autoupdate/branches/2.0

  • extensions/autoupdate/branches/2.0/autoupdate.php

    r10029 r10038  
    123123  include_once(AUTOUPDATE_PATH.'include/autoupdate.class.php');
    124124  $autoupdate = new autoupdate();
     125  $autoupdate->get_merged_extensions($upgrade_to);
    125126  $autoupdate->get_server_extensions($upgrade_to);
    126127  $template->assign('missing', $autoupdate->missing);
  • extensions/autoupdate/branches/2.0/include/autoupdate.class.php

    r10029 r10038  
    88  var $plugins;
    99  var $themes;
    10   var $languages;
    1110  var $missing = array();
    1211  var $default_plugins = array();
    1312  var $default_themes = array();
     13  var $merged_extensions = array();
     14  var $merged_extension_url = 'http://piwigo.org/download/merged_extensions.txt';
    1415
    1516  function autoupdate()
     
    199200      foreach ($this->$type->$fs as $ext_id => $ext)
    200201      {
    201         if (isset($ext['extension']) and $id == $ext['extension'] and !in_array($ext_id, $this->$default))
     202        if (isset($ext['extension']) and $id == $ext['extension']
     203          and !in_array($ext_id, $this->$default)
     204          and !in_array($ext['extension'], $this->merged_extensions))
    202205        {
    203206          $this->missing[$type][] = $ext;
     
    208211  }
    209212
     213  function get_merged_extensions($version)
     214  {
     215    if (fetchRemote($this->merged_extension_url, $result))
     216    {
     217      $rows = explode("\n", $result);
     218      foreach ($rows as $row)
     219      {
     220        if (preg_match('/^(\d+\.\d+): *(.*)$/', $row, $match))
     221        {
     222          if (version_compare($version, $match[1], '>='))
     223          {
     224            $extensions = explode(',', trim($match[2]));
     225            $this->merged_extensions = array_merge($this->merged_extensions, $extensions);
     226          }
     227        }
     228      }
     229    }
     230  }
     231
    210232  function version_compare($a, $b, $type)
    211233  {
Note: See TracChangeset for help on using the changeset viewer.