Changeset 7502
- Timestamp:
- 02/16/08 07:54:21 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.1/lib/plugins/sfPropelPlugin/lib/task/sfPropelBuildSchemaTask.class.php
r7247 r7502 55 55 $this->callPhing('creole', self::DO_NOT_CHECK_SCHEMA); 56 56 57 $xmlSchemaPath = sfConfig::get('sf_config_dir').'/schema.xml'; 58 $ymlSchemaPath = sfConfig::get('sf_config_dir').'/schema.yml'; 59 57 60 // Fix database name 58 if (file_exists( sfConfig::get('sf_config_dir').'/schema.xml'))61 if (file_exists($xmlSchemaPath)) 59 62 { 60 $schema = file_get_contents( sfConfig::get('sf_config_dir').'/schema.xml');63 $schema = file_get_contents($xmlSchemaPath); 61 64 $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); 63 66 } 64 67 65 if (! isset($options['xml']))68 if (!$options['xml']) 66 69 { 67 70 $this->schemaToYML(self::DO_NOT_CHECK_SCHEMA, ''); 68 71 $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 } 69 84 } 70 85 }