* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /** * Clears all non production environment controllers. * * @package symfony * @subpackage task * @author Fabien Potencier * @version SVN: $Id: sfProjectClearControllersTask.class.php 10582 2008-08-01 14:45:42Z nicolas $ */ class sfProjectClearControllersTask extends sfBaseTask { /** * @see sfTask */ protected function configure() { $this->aliases = array('clear-controllers'); $this->namespace = 'project'; $this->name = 'clear-controllers'; $this->briefDescription = 'Clears all non production environment controllers'; $this->detailedDescription = <<maxdepth(1)->name('*.php'); foreach ($finder->in(sfConfig::get('sf_web_dir')) as $controller) { $content = file_get_contents($controller); if (preg_match('/ProjectConfiguration::getApplicationConfiguration\(\'(.*?)\', \'(.*?)\'/', $content, $match)) { // Remove file if it has found an application and the environment is not production if ($match[2] != 'prod') { $this->getFilesystem()->remove($controller); } } } } }