I am currently working on a build system in Phing that accepts a Zend Framework project template and customizes it according to the Phing settings. One problem I am facing is using Zend_Config_Writer_Ini.
My Phing task takes a pre-populated file from the repo called application.default.ini and modifies it with Zend_Config_Ini to add parameters from the build file (db data, etc.). He then writes it to application.ini, ready for use by the project. A simplified version of the corresponding task code looks something like this:
$appConfig = new Zend_Config_Ini( $appDefaultConfigPath, null, array( 'skipExtends' => true, 'allowModifications' => true ) ); $appConfig->production->resources->db->params->host = $buildProperties->db->host; $appConfig->production->resources->db->params->username = $buildProperties->db->username; $appConfig->production->resources->db->params->password = $buildProperties->db->password; $appConfig->production->resources->db->params->dbname = $buildProperties->db->dbname; $writer = new Zend_Config_Writer_Ini(); $writer->setConfig($appConfig) ->setFilename($appConfigPath) ->write();
This works fine considering database credentials, but when it comes to pre-populated paths that contain certain constants, something goes wrong. For example:
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
becomes:
bootstrap.path = "APPLICATION_PATH/Bootstrap.php"
Is there a way to save these configuration lines when reading / writing in different ini files, or do I need to rebuild the assembly file to copy the file before starting the task and change only the ini lines that I need to change?
Tom jowitt
source share