Dotclear

Changeset 1231:415e762385aa


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

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • admin/update.php

    r1179 r1231  
    2727 
    2828$updater = new dcUpdate(DC_UPDATE_URL,'dotclear',DC_UPDATE_VERSION,DC_TPL_CACHE.'/versions'); 
    29 $new_v = $updater->check(DC_VERSION); 
     29$new_v = $updater->check(DC_VERSION, !empty($_GET['nocache'])); 
    3030$zip_file = $new_v ? DC_BACKUP_PATH.'/'.basename($updater->getFileURL()) : ''; 
    3131$version_info = $new_v ? $updater->getInfoURL() : ''; 
     
    173173if (!$core->error->flag()) { 
    174174     echo '<h2>'.__('Dotclear update').'</h2>'; 
     175      
     176     if (!empty($_GET['nocache'])) { 
     177          dcPage::message(__('Manual checking of update done successfully.')); 
     178     } 
    175179} 
    176180 
     
    180184     if (empty($new_v)) 
    181185     { 
    182           echo '<p><strong>'.__('No newer Dotclear version available.').'</strong></p>'; 
     186          echo '<p><strong>'.__('No newer Dotclear version available.').'</strong></p>'. 
     187          '<form action="'.$p_url.'" method="get">'. 
     188          '<p><input type="hidden" name="nocache" value="1" />'. 
     189          '<input type="submit" value="'.__('Force checking update Dotclear').'" /></p>'. 
     190          '</form>'; 
    183191     } 
    184192     else 
  • 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); 
  • locales/fr/main.po

    r1193 r1231  
    19911991msgstr "Les fichiers suivants de votre installation de Dotclear ne peuvent pas être écrits. Veuillez corriger la situation ou <a href=\"http://fr.dotclear.org/download\">mettre à jour manuellement</a>." 
    19921992 
     1993msgid "Manual checking of update done successfully." 
     1994msgstr "Vérification manuelle de mise à jour effectuée avec succès." 
     1995 
    19931996msgid "No newer Dotclear version available." 
    19941997msgstr "Aucune nouvelle version de Dotclear n'est disponible." 
     1998 
     1999msgid "Force checking update Dotclear" 
     2000msgstr "Forcer la vérification de mise à jour de Dotclear" 
    19952001 
    19962002#, php-format 
Note: See TracChangeset for help on using the changeset viewer.

Sites map