Development

Changeset 8369

You must first sign up to be able to contribute.

Changeset 8369

Show
Ignore:
Timestamp:
04/09/08 01:39:27 (1 year ago)
Author:
dwhittle
Message:

1.1: tweaked propel upgrade task to only execute if propel.ini exists

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/task/project/upgrade1.1/sfPropelUpgrade.class.php

    r7397 r8369  
    44 * This file is part of the symfony package. 
    55 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com> 
    6  *  
     6 * 
    77 * For the full copyright and license information, please view the LICENSE 
    88 * file that was distributed with this source code. 
     
    2222  { 
    2323    $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); 
    2428 
    25     $content = file_get_contents($file); 
    26     $content = str_replace('addon.propel.builder.', 'plugins.sfPropelPlugin.lib.propel.builder.', $content, $count); 
     29      if ($count) 
     30      { 
     31        $this->logSection('propel', sprintf('Migrating %s', $file)); 
     32        file_put_contents($file, $content); 
     33      } 
    2734 
    28     if ($count) 
    29     { 
    30       $this->logSection('propel', sprintf('Migrating %s', $file)); 
    31       file_put_contents($file, $content); 
    32     } 
    33  
    34     // add default date and time format 
    35     $content = file_get_contents($file); 
    36     if (false === strpos($content, 'propel.defaultDateFormat')) 
    37     { 
    38       $content .= <<<EOF 
     35      // add default date and time format 
     36      $content = file_get_contents($file); 
     37      if (false === strpos($content, 'propel.defaultDateFormat')) 
     38      { 
     39        $content .= <<<EOF 
    3940 
    4041propel.defaultTimeStampFormat = Y-m-d H:i:s 
     
    4344 
    4445EOF; 
    45       $this->logSection('propel', sprintf('Migrating %s', $file)); 
    46       file_put_contents($file, $content); 
     46        $this->logSection('propel', sprintf('Migrating %s', $file)); 
     47        file_put_contents($file, $content); 
     48      } 
    4749    } 
    4850  } 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.