コード例 #1
0
ファイル: Compiler.php プロジェクト: rodacom/jelix
 protected function readConfigFiles($configFile, $additionalOptions)
 {
     $configPath = App::configPath();
     // this is the defaultconfig file of JELIX itself
     $config = IniFileMgr::read(__DIR__ . '/defaultconfig.ini.php', true);
     // read the main configuration of the app
     $mcf = App::mainConfigFile();
     if ($mcf) {
         IniFileMgr::readAndMergeObject($mcf, $config);
     }
     $this->commonConfig = clone $config;
     // read the local configuration of the app
     if (file_exists($configPath . 'localconfig.ini.php')) {
         IniFileMgr::readAndMergeObject($configPath . 'localconfig.ini.php', $config);
     }
     // read the configuration specific to the entry point
     if ($configFile != '' && $configPath . $configFile != $mcf) {
         if (!file_exists($configPath . $configFile)) {
             throw new Exception("Configuration file is missing -- {$configFile}", 5);
         }
         if (false === IniFileMgr::readAndMergeObject($configPath . $configFile, $config)) {
             throw new Exception("Syntax error in the configuration file -- {$configFile}", 6);
         }
     }
     if ($additionalOptions) {
         IniFileMgr::mergeIniObjectContents($config, $additionalOptions);
     }
     return $config;
 }