|
Revision 13493, 1.6 kB
(checked in by fabien, 5 years ago)
|
[1.2] added automatic migration for the generated symfony CLI
|
- 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 sfConfigurationUpgrade extends sfUpgrade |
|---|
| 20 |
{ |
|---|
| 21 |
public function upgrade() |
|---|
| 22 |
{ |
|---|
| 23 |
$file = sfConfig::get('sf_config_dir').'/ProjectConfiguration.class.php'; |
|---|
| 24 |
$content = file_get_contents($file); |
|---|
| 25 |
|
|---|
| 26 |
if (!preg_match('/(enablePlugins|disablePlugins|enableAllPluginsExcept)/', $content)) |
|---|
| 27 |
{ |
|---|
| 28 |
$content = preg_replace("#(setup\(\)\s+{\s+)#s", "$1 \$this->enableAllPluginsExcept(array('sfDoctrinePlugin', 'sfCompat10Plugin'));\n ", $content, -1, $count); |
|---|
| 29 |
if ($count) |
|---|
| 30 |
{ |
|---|
| 31 |
$this->logSection('config', sprintf('Migrating %s', $file)); |
|---|
| 32 |
file_put_contents($file, $content); |
|---|
| 33 |
} |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
$file = sfConfig::get('sf_root_dir').'/symfony'; |
|---|
| 38 |
$content = file_get_contents($file); |
|---|
| 39 |
|
|---|
| 40 |
if (preg_match('/ProjectConfiguration/', $content)) |
|---|
| 41 |
{ |
|---|
| 42 |
$content = str_replace("\$configuration = new ProjectConfiguration();\n", '', $content); |
|---|
| 43 |
$content = str_replace("\$configuration->getSymfonyLibDir()", 'sfCoreAutoload::getInstance()->getBaseDir()', $content); |
|---|
| 44 |
$this->logSection('config', sprintf('Migrating %s', $file)); |
|---|
| 45 |
file_put_contents($file, $content); |
|---|
| 46 |
} |
|---|
| 47 |
} |
|---|
| 48 |
} |
|---|
| 49 |
|
|---|