|
Revision 8369, 1.3 kB
(checked in by dwhittle, 5 years ago)
|
1.1: tweaked propel upgrade task to only execute if propel.ini exists
|
- 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 sfPropelUpgrade extends sfUpgrade |
|---|
| 20 |
{ |
|---|
| 21 |
public function upgrade() |
|---|
| 22 |
{ |
|---|
| 23 |
$file = sfConfig::get('sf_config_dir').'/propel.ini'; |
|---|
| 24 |
if(is_readable($file)) |
|---|
| 25 |
{ |
|---|
| 26 |
$content = file_get_contents($file); |
|---|
| 27 |
$content = str_replace('addon.propel.builder.', 'plugins.sfPropelPlugin.lib.propel.builder.', $content, $count); |
|---|
| 28 |
|
|---|
| 29 |
if ($count) |
|---|
| 30 |
{ |
|---|
| 31 |
$this->logSection('propel', sprintf('Migrating %s', $file)); |
|---|
| 32 |
file_put_contents($file, $content); |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
$content = file_get_contents($file); |
|---|
| 37 |
if (false === strpos($content, 'propel.defaultDateFormat')) |
|---|
| 38 |
{ |
|---|
| 39 |
$content .= <<<EOF |
|---|
| 40 |
|
|---|
| 41 |
propel.defaultTimeStampFormat = Y-m-d H:i:s |
|---|
| 42 |
propel.defaultTimeFormat = H:i:s |
|---|
| 43 |
propel.defaultDateFormat = Y-m-d |
|---|
| 44 |
|
|---|
| 45 |
EOF; |
|---|
| 46 |
$this->logSection('propel', sprintf('Migrating %s', $file)); |
|---|
| 47 |
file_put_contents($file, $content); |
|---|
| 48 |
} |
|---|
| 49 |
} |
|---|
| 50 |
} |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|