Development

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

You must first sign up to be able to contribute.

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

Revision 8369, 1.3 kB (checked in by dwhittle, 6 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  * This file is part of the symfony package.
5  * (c) 2004-2006 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  * Upgrade propel.ini.
13  *
14  * @package    symfony
15  * @subpackage task
16  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
17  * @version    SVN: $Id$
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       // add default date and time format
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
Note: See TracBrowser for help on using the browser.