/** * Loads the main configuration ini file and adds it to the registry. * The 'config' directory will be updated to have the provided profile * appended to it, e.g. './config' becomes './config/default' * * @param string $profile * @return object */ public function loadConfig($profile) { if (Registry::has('config') && Registry::has('config_ini')) { return Registry::get('config'); } $configDir = $this->getDir('config') . '/' . $profile; try { $configIni = new Config_ini(); $configIni->load($configDir . '/config.ini.php'); Registry::register('config_ini', $configIni); // Merge the ini configuration in to the main config library $config = new Config(); $config->load($configIni); Registry::register('config', $config); // Store the profile name and update the 'config' dir value $this->setDir('config', $configDir); $this->configProfile = $profile; $this->configPath = $configDir . '/config.ini.php'; return $config; } catch (Config_Ini_FileNoExist $e) { throw new Zula_Exception('Zula configuration file "' . $configDir . '/config.ini.php" does not exist or is not readable', 8); } }