コード例 #1
0
 public function upgrade()
 {
     if (!in_array('sfPropelPlugin', $this->configuration->getPlugins())) {
         if (file_exists($file = sfConfig::get('sf_config_dir') . '/propel.ini')) {
             $this->getFilesystem()->remove($file);
         }
         return;
     }
     if (file_exists($old = sfConfig::get('sf_lib_dir') . '/filter/base/BaseFormFilterPropel.class.php') && !file_exists($new = sfConfig::get('sf_lib_dir') . '/filter/BaseFormFilterPropel.class.php')) {
         $this->getFilesystem()->rename($old, $new);
     }
     if (file_exists($file = sfConfig::get('sf_config_dir') . '/propel.ini')) {
         // use phing to parse propel.ini
         sfPhing::startup();
         $this->properties = new Properties();
         $this->properties->load(new PhingFile($file));
         $modified = $original = file_get_contents($file);
         $modified = $this->upgradePropelIni($modified, self::$removes, false);
         $modified = $this->upgradePropelIni($modified, self::$inserts, true);
         if ($original != $modified) {
             $this->logSection('propel', 'Upgrading ' . sfDebug::shortenFilePath($file));
             file_put_contents($file, $modified);
         }
     }
 }