コード例 #1
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     $app = $arguments['application'];
     $env = $arguments['env'];
     $lockFile = sfConfig::get('sf_data_dir') . '/' . $app . '_' . $env . '.lck';
     if (!file_exists($lockFile)) {
         $this->logSection('enable', sprintf('%s [%s] is currently ENABLED', $app, $env));
     } else {
         $this->getFilesystem()->remove($lockFile);
         $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter);
         $clearCache->setCommandApplication($this->commandApplication);
         $clearCache->run(array(), array('--app=' . $app, '--env=' . $env));
         $this->logSection('enable', sprintf('%s [%s] has been ENABLED', $app, $env));
     }
 }
コード例 #2
0
 /**
  * @see sfTask
  */
 protected function execute($arguments = array(), $options = array())
 {
     if (1 == count($arguments['app']) && !file_exists(sfConfig::get('sf_apps_dir') . '/' . $arguments['app'][0])) {
         // support previous task signature
         $applications = array($arguments['env']);
         $env = $arguments['app'][0];
     } else {
         $applications = count($arguments['app']) ? $arguments['app'] : sfFinder::type('dir')->relative()->maxdepth(0)->in(sfConfig::get('sf_apps_dir'));
         $env = $arguments['env'];
     }
     foreach ($applications as $app) {
         $lockFile = sfConfig::get('sf_data_dir') . '/' . $app . '_' . $env . '.lck';
         if (!file_exists($lockFile)) {
             $this->logSection('enable', sprintf('%s [%s] is currently ENABLED', $app, $env));
         } else {
             $this->getFilesystem()->remove($lockFile);
             $clearCache = new sfCacheClearTask($this->dispatcher, $this->formatter);
             $clearCache->setCommandApplication($this->commandApplication);
             $clearCache->setConfiguration($this->configuration);
             $clearCache->run(array(), array('--app=' . $app, '--env=' . $env));
             $this->logSection('enable', sprintf('%s [%s] has been ENABLED', $app, $env));
         }
     }
 }