|
Revision 9793, 1.5 kB
(checked in by fabien, 5 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 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 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 |
|
|---|