Development

Changeset 9890

You must first sign up to be able to contribute.

Changeset 9890

Show
Ignore:
Timestamp:
06/26/08 13:35:01 (5 months ago)
Author:
fabien
Message:

fxed locking issues with the cache:clear, project:disable, project:enable, and log:rotate tasks (closes #3598)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/config/sfApplicationConfiguration.class.php

    r9722 r9890  
    175175  public function checkLock() 
    176176  { 
    177     if (sfToolkit::hasLockFile(sfConfig::get('sf_cache_dir').DIRECTORY_SEPARATOR.$this->getApplication().'_'.$this->getEnvironment().'.lck', 5)) 
     177    if ( 
     178      sfToolkit::hasLockFile(sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.$this->getApplication().'_'.$this->getEnvironment().'-cli.lck', 5) 
     179      || 
     180      sfToolkit::hasLockFile(sfConfig::get('sf_data_dir').DIRECTORY_SEPARATOR.$this->getApplication().'_'.$this->getEnvironment().'.lck') 
     181    ) 
    178182    { 
    179183      // application is not available - we'll find the most specific unavailable page... 
  • branches/1.1/lib/task/cache/sfCacheClearTask.class.php

    r8148 r9890  
    206206  protected function getLockFile($app, $env) 
    207207  { 
    208     return sfConfig::get('sf_cache_dir').'/'.$app.'_'.$env.'.lck'; 
     208    return sfConfig::get('sf_data_dir').'/'.$app.'_'.$env.'-cli.lck'; 
    209209  } 
    210210} 
  • branches/1.1/lib/task/log/sfLogRotateTask.class.php

    r9097 r9890  
    120120    { 
    121121      // create a lock file 
    122       touch(sfConfig::get('sf_cache_dir').'/'.$app.'_'.$env.'.lck'); 
     122      $lockFile = sfConfig::get('sf_data_dir').'/'.$app.'_'.$env.'-cli.lck'; 
     123      $this->getFilesystem()->touch($lockFile); 
     124 
     125      // change mode so the web user can remove it if we die 
     126      $this->getFilesystem()->chmod($lockFile, 0777); 
    123127 
    124128      // if log file exists rotate it 
     
    151155        } 
    152156      } 
     157 
     158      // release lock 
     159      $this->getFilesystem()->remove($lockFile); 
    153160    } 
    154161  } 
  • branches/1.1/lib/task/project/sfProjectDisableTask.class.php

    r8449 r9890  
    4949    $env = $arguments['env']; 
    5050 
    51     $lockFile = sfConfig::get('sf_cache_dir').'/'.$app.'_'.$env.'.lck'; 
     51    $lockFile = sfConfig::get('sf_data_dir').'/'.$app.'_'.$env.'.lck'; 
    5252    if (file_exists($lockFile)) 
    5353    { 
    5454      $this->logSection('enable', sprintf('%s [%s] is currently DISABLED', $app, $env)); 
    5555    } 
     56    else 
     57    { 
     58      $this->getFilesystem()->touch($lockFile); 
    5659 
    57     $this->getFilesystem()->touch($lockFile); 
    58  
    59     $this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env)); 
     60      $this->logSection('enable', sprintf('%s [%s] has been DISABLED', $app, $env)); 
     61    } 
    6062  } 
    6163} 
  • branches/1.1/lib/task/project/sfProjectEnableTask.class.php

    r7401 r9890  
    4949    $env = $arguments['env']; 
    5050 
    51     $lockFile = $app.'_'.$env.'.lck'; 
    52     if (!file_exists(sfConfig::get('sf_cache_dir').'/'.$lockFile)) 
     51    $lockFile = sfConfig::get('sf_data_dir').'/'.$app.'_'.$env.'.lck'; 
     52    if (!file_exists($lockFile)) 
    5353    { 
    5454      $this->logSection('enable', sprintf('%s [%s] is currently ENABLED', $app, $env)); 
    5555    } 
     56    else 
     57    { 
     58      $this->getFilesystem()->remove($lockFile); 
    5659 
    57     $this->getFilesystem()->remove($lockFile); 
     60      $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter); 
     61      $clearCache->setCommandApplication($this->commandApplication); 
     62      $clearCache->run(); 
    5863 
    59     $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter); 
    60     $clearCache->setCommandApplication($this->commandApplication); 
    61     $clearCache->run(); 
    62  
    63     $this->logSection('enable', sprintf('%s [%s] has been ENABLED', $app, $env)); 
     64      $this->logSection('enable', sprintf('%s [%s] has been ENABLED', $app, $env)); 
     65    } 
    6466  } 
    6567}