Dotclear


Ignore:
Timestamp:
07/26/13 09:14:57 (12 years ago)
Author:
Denis Jean-Christian <contact@…>
Branch:
Ticket 1412
Message:

Forcer le test d'existance de mise à jour, closes #1412

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/core/class.dc.update.php

    r1179 r1231  
    3232      
    3333     protected $cache_ttl = '-6 hours'; 
     34     protected $nocache_ttl = '-2 mins'; 
    3435     protected $forced_files = array(); 
    3536      
     
    5556      *  
    5657      * @param version        string    Current version to compare 
     58      * @param nocache        boolean   Force checking 
    5759      * @return string                  Latest version if available 
    5860      */ 
    59      public function check($version) 
    60      { 
    61           $this->getVersionInfo(); 
     61     public function check($version, $nocache=false) 
     62     { 
     63          $this->getVersionInfo($nocache); 
    6264          $v = $this->getVersion(); 
    6365          if ($v && version_compare($version,$v,'<')) { 
     
    6870     } 
    6971      
    70      public function getVersionInfo() 
    71      { 
     72     public function getVersionInfo($nocache=false) 
     73     { 
     74          # Check minimum time without cache (prevents from server flood) 
     75          if ($nocache && is_readable($this->cache_file) && filemtime($this->cache_file) > strtotime($this->nocache_ttl)) { 
     76               $nocache = false; 
     77          } 
     78           
    7279          # Check cached file 
    73           if (is_readable($this->cache_file) && filemtime($this->cache_file) > strtotime($this->cache_ttl)) 
     80          if (is_readable($this->cache_file) && filemtime($this->cache_file) > strtotime($this->cache_ttl) && !$nocache) 
    7481          { 
    7582               $c = @file_get_contents($this->cache_file); 
Note: See TracChangeset for help on using the changeset viewer.

Sites map