sfFactories12Upgrade.class.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Upgrades factories.yml configuration file.
  11. *
  12. * @package symfony
  13. * @subpackage task
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. * @version SVN: $Id: sfFactories12Upgrade.class.php 10628 2008-08-03 15:03:08Z fabien $
  16. */
  17. class sfFactories12Upgrade extends sfUpgrade
  18. {
  19. public function upgrade()
  20. {
  21. $phpFinder = $this->getFinder('file')->name('factories.yml');
  22. foreach ($phpFinder->in($this->getProjectConfigDirectories()) as $file)
  23. {
  24. $content = file_get_contents($file);
  25. if (!preg_match('/send_http_headers/', $content))
  26. {
  27. $tmp = <<<EOF
  28. response:
  29. class: sfWebResponse
  30. param:
  31. send_http_headers: false
  32. EOF;
  33. $content = str_replace('test:', 'test:'."\n".$tmp, $content);
  34. $this->logSection('factories.yml', sprintf('Migrating %s', $file));
  35. file_put_contents($file, $content);
  36. }
  37. }
  38. }
  39. }