Development

Changeset 7824

You must first sign up to be able to contribute.

Changeset 7824

Show
Ignore:
Timestamp:
03/12/08 13:28:48 (8 months ago)
Author:
fabien
Message:

tweaked cache:clear (dwhittle:r7822)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/task/cache/sfCacheClearTask.class.php

    r7815 r7824  
    8080    $dirFinder = sfFinder::type('dir')->ignore_version_control()->discard('.sf')->maxdepth(0)->relative(); 
    8181 
    82     // clear global cache 
    83     if (is_null($options['app'])) 
    84     { 
    85       $this->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in(sfConfig::get('sf_cache_dir'))); 
    86     } 
    87  
    8882    // iterate through applications 
    8983    $apps = is_null($options['app']) ? $dirFinder->in(sfConfig::get('sf_apps_dir')) : array($options['app']); 
    9084    foreach ($apps as $app) 
    9185    { 
     86      $class = $app.'Configuration'; 
     87      require_once sfConfig::get('sf_lib_dir').'/'.$class.'.class.php'; 
     88      $appConfiguration = new $class('cli', true); 
     89 
    9290      if (!is_dir(sfConfig::get('sf_cache_dir').'/'.$app)) 
    9391      { 
    9492        continue; 
    9593      } 
    96  
    97       $class = $app.'Configuration'; 
    98       require_once sfConfig::get('sf_lib_dir').'/'.$class.'.class.php'; 
    99       $appConfiguration = new $class('dev', true); 
    10094 
    10195      // iterate through environments 
     
    119113          if (!method_exists($this, $method)) 
    120114          { 
    121             throw new InvalidArgumentException(sprintf('Don\'t know how to remove the cache for type "%s".', $options['type'])); 
     115            throw new InvalidArgumentException(sprintf('Do not know how to remove cache for type "%s".', $options['type'])); 
    122116          } 
    123117          $this->$method($appConfiguration, $env); 
     
    126120        $this->unlock($app, $env); 
    127121      } 
     122    } 
     123 
     124    // clear global cache 
     125    if (is_null($options['app'])) 
     126    { 
     127      $this->getFilesystem()->remove(sfFinder::type('file')->ignore_version_control()->discard('.sf')->in(sfConfig::get('sf_cache_dir'))); 
    128128    } 
    129129  }