/** * Loads a staging configuration file and overloads the given array. * * @param array the array to overload * * @return array Merged configuration. */ public static function overloadWithStagingConfig($array_to_overload) { // load staging config $staging_config = \Koch\Config\Adapter\INI::read(self::getFilename()); // keys/values of array_to_overload are replaced with those of the staging_config return array_replace_recursive($array_to_overload, $staging_config); }
/** * Fetches the Application Main Config from file or APC. * * @return type */ public function getApplicationConfig() { $config = []; $apcAppKey = APPLICATION_NAME . '.config'; // load config from APC if (APC && apc_exists($apcAppKey)) { $config = apc_fetch($apcAppKey); } else { // load config from file $config = \Koch\Config\Adapter\INI::read(APPLICATION_PATH . 'Configuration/' . APPLICATION_NAME . '.php'); // set to APC if (APC) { apc_add($apcAppKey, $config); } } unset($apcAppKey); // merge config with a staging configuration if (isset($config['config']['staging']) && (bool) $config['config']['staging']) { $config = \Koch\Config\Staging::overloadWithStagingConfig($config); } return $config; }