Development

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

You must first sign up to be able to contribute.

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

Revision 9793, 1.5 kB (checked in by fabien, 6 years ago)

fixed error reporting value for the test environment and added a migration task (closes #3478)

  • 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 settings.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 sfSettingsUpgrade extends sfUpgrade
20 {
21   public function upgrade()
22   {
23     $phpFinder = $this->getFinder('file')->name('settings.yml');
24     foreach ($phpFinder->in($this->getProjectConfigDirectories()) as $file)
25     {
26       $content = file_get_contents($file);
27       $content = preg_replace(
28         '#error_reporting\:(\s+)'.preg_quote('<?php echo (E_ALL | E_STRICT & ~E_NOTICE)."\n" ?>', '#').'#',
29         'error_reporting:$1<?php echo ((E_ALL | E_STRICT) ^ E_NOTICE)."\n" ?>',
30         $content, -1, $count1
31       );
32       $content = preg_replace(
33         '#error_reporting\:(\s+)4095#',
34         'error_reporting:$1<?php echo (E_ALL | E_STRICT)."\n" ?>',
35         $content, -1, $count2
36       );
37       $content = preg_replace(
38         '#error_reporting\:(\s+)2047#',
39         'error_reporting:$1<?php echo ((E_ALL | E_STRICT) ^ E_NOTICE)."\n" ?>',
40         $content, -1, $count3
41       );
42
43       if ($count1 || $count2 || $count3)
44       {
45         $this->logSection('settings.yml', sprintf('Migrating %s', $file));
46         file_put_contents($file, $content);
47       }
48     }
49   }
50 }
51
Note: See TracBrowser for help on using the browser.