/** * Load configuration file, if it was not loaded previously. * * This means that second and subsequent calls attempt to load * the configuration again only if previous attempts have failed. * * Otherwise, cached configuration data is used. * * If the loading fails, isConfigured() will return false. * * @return void */ public static function load() { if (self::isConfigured()) { return; } $parameters = self::getParameterDescription(); if (!file_exists('../config/configuration.php')) { // Leave fajr unconfigured, index.php will then show nice error message // to the user return; } // Don't suppress errors so parse errors are reported // TODO(anty): use yaml for configuration $result = (include '../config/configuration.php'); if (!is_array($result)) { throw new Exception('Konfiguračný súbor nevrátil pole'); } $config = ConfigUtils::parseAndValidateConfiguration($parameters, $result); foreach ($config['AIS2.ServerList'] as $key => $server) { if ($key !== $server->getServerName()) { throw new Exception("Nesedí meno servera v konfiguracii AIS2.ServerList"); } } self::$config = $config; }
public static function load() { if (self::isConfigured()) { return; } @($result = (include '../config/configuration.php')); if ($result !== false && is_array($result)) { self::$config = array_merge(self::$defaultOptions, $result); } }