Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to preserve application.ini paths using Zend_Config_Writer_Ini
    primarykey
    data
    text
    <p>I'm currently working on a build system in Phing that takes a Zend Framework project template and configures it according to Phing parameters. One problem that I've come across is when using Zend_Config_Writer_Ini.</p> <p>My Phing task takes a pre-populated file from the repo called application.default.ini and modifies this using Zend_Config_Ini to add parameters from the build file (db details, etc). It then writes it to application.ini ready for the project to use. A simplified version of the related task code looks something like this:</p> <pre><code>$appConfig = new Zend_Config_Ini( $appDefaultConfigPath, null, array( 'skipExtends' =&gt; true, 'allowModifications' =&gt; true ) ); $appConfig-&gt;production-&gt;resources-&gt;db-&gt;params-&gt;host = $buildProperties-&gt;db-&gt;host; $appConfig-&gt;production-&gt;resources-&gt;db-&gt;params-&gt;username = $buildProperties-&gt;db-&gt;username; $appConfig-&gt;production-&gt;resources-&gt;db-&gt;params-&gt;password = $buildProperties-&gt;db-&gt;password; $appConfig-&gt;production-&gt;resources-&gt;db-&gt;params-&gt;dbname = $buildProperties-&gt;db-&gt;dbname; $writer = new Zend_Config_Writer_Ini(); $writer-&gt;setConfig($appConfig) -&gt;setFilename($appConfigPath) -&gt;write(); </code></pre> <p>This works fine as far as the database credentials go but when it comes to pre-populated paths that include defined constants something goes wrong. For example:</p> <pre><code>bootstrap.path = APPLICATION_PATH "/Bootstrap.php" </code></pre> <p>becomes:</p> <pre><code>bootstrap.path = "APPLICATION_PATH/Bootstrap.php" </code></pre> <p>Is there any way to preserve these config lines when reading/writing to different ini files or should I restructure my build file to copy the file before running the task and only modify the ini lines that I need to change?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload