Development

Changeset 7502

You must first sign up to be able to contribute.

Changeset 7502

Show
Ignore:
Timestamp:
02/16/08 07:54:21 (8 months ago)
Author:
fabien
Message:

fixed propel:build-schema task --xml option

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildSchemaTask.class.php

    r7247 r7502  
    5555    $this->callPhing('creole', self::DO_NOT_CHECK_SCHEMA); 
    5656 
     57    $xmlSchemaPath = sfConfig::get('sf_config_dir').'/schema.xml'; 
     58    $ymlSchemaPath = sfConfig::get('sf_config_dir').'/schema.yml'; 
     59 
    5760    // Fix database name 
    58     if (file_exists(sfConfig::get('sf_config_dir').'/schema.xml')) 
     61    if (file_exists($xmlSchemaPath)) 
    5962    { 
    60       $schema = file_get_contents(sfConfig::get('sf_config_dir').'/schema.xml'); 
     63      $schema = file_get_contents($xmlSchemaPath); 
    6164      $schema = preg_replace('/<database\s+name="[^"]+"/s', '<database name="propel"', $schema); 
    62       file_put_contents(sfConfig::get('sf_config_dir').'/schema.xml', $schema); 
     65      file_put_contents($xmlSchemaPath, $schema); 
    6366    } 
    6467 
    65     if (!isset($options['xml'])
     68    if (!$options['xml']
    6669    { 
    6770      $this->schemaToYML(self::DO_NOT_CHECK_SCHEMA, ''); 
    6871      $this->cleanup(); 
     72 
     73      if (file_exists($xmlSchemaPath)) 
     74      { 
     75        unlink($xmlSchemaPath); 
     76      } 
     77    } 
     78    else 
     79    { 
     80      if (file_exists($ymlSchemaPath)) 
     81      { 
     82        unlink($ymlSchemaPath); 
     83      } 
    6984    } 
    7085  }