From: <gem...@li...> - 2012-07-30 14:47:49
|
Revision: 886 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=886&view=rev Author: mennodekker Date: 2012-07-30 14:47:40 +0000 (Mon, 30 Jul 2012) Log Message: ----------- Allow upgrades to run in each environment Modified Paths: -------------- trunk/library/classes/Gems/UpgradesAbstract.php Modified: trunk/library/classes/Gems/UpgradesAbstract.php =================================================================== --- trunk/library/classes/Gems/UpgradesAbstract.php 2012-07-30 08:43:21 UTC (rev 885) +++ trunk/library/classes/Gems/UpgradesAbstract.php 2012-07-30 14:47:40 UTC (rev 886) @@ -51,6 +51,18 @@ protected $_messages = array(); + /** + * Holds the inital config file + * + * @var Zend_Config + */ + protected $originalFile; + + /** + * Holds the config file specific to this environment + * + * @var Zend_Config + */ protected $upgradeFile; /** @@ -93,11 +105,17 @@ //First get a GemsEscort instance, as we might need that a lot (and it can not be injected) $this->escort = GemsEscort::getInstance(); - $this->upgradeFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR , '/var/settings/upgrades.ini'); + $this->originalFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR , '/var/settings/upgrades.ini'); + $this->upgradeFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR , '/var/settings/upgrades_' . APPLICATION_ENV . '.ini'); + if(!file_exists($this->originalFile)) { + touch($this->originalFile); + } if(!file_exists($this->upgradeFile)) { touch($this->upgradeFile); } - $this->_info = new Zend_Config_Ini($this->upgradeFile, null, array('allowModifications' => true)); + $this->_info = new Zend_Config_Ini($this->originalFile, null, array('allowModifications' => true)); + // Merge the environment config file + $this->_info->merge(new Zend_Config_Ini($this->upgradeFile, null, array('allowModifications' => true))); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |