Development

/branches/1.1/lib/task/project/upgrade1.1/sfFactoriesUpgrade.class.php

You must first sign up to be able to contribute.

root/branches/1.1/lib/task/project/upgrade1.1/sfFactoriesUpgrade.class.php

Revision 7397, 1.2 kB (checked in by fabien, 7 years ago)

added sfTask::log() and sfTask::logSection() shortcuts

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 /**
12  * Upgrades factories.yml configuration file.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
18  */
19 class sfFactoriesUpgrade extends sfUpgrade
20 {
21   public function upgrade()
22   {
23     $phpFinder = $this->getFinder('file')->name('factories.yml');
24     foreach ($phpFinder->in($this->getProjectConfigDirectories()) as $file)
25     {
26       $content = file_get_contents($file);
27       $content = str_replace('automaticCleaningFactor', 'automatic_cleaning_factor', $content, $count1);
28       $content = str_replace('cacheDir', 'cache_dir', $content, $count2);
29
30       if ($count1 || $count2)
31       {
32         $content = preg_replace('/^((.+)automatic_cleaning_factor:(\s+)(.+?))$/m', "$1\n$2prefix:$3                   %SF_APP_DIR%", $content);
33
34         $this->logSection('factories.yml', sprintf('Migrating %s', $file));
35         file_put_contents($file, $content);
36       }
37     }
38   }
39 }
40
Note: See TracBrowser for help on using the browser.