Example #1
0
 protected static function loadConfiguration()
 {
     Logging::log('Loading configuration from cache', 'core');
     if (self::isReadySetup()) {
         $configuration = self::getCache()->get(Cache::KEY_CONFIGURATION, false);
         if (!$configuration) {
             Logging::log('Loading configuration from disk cache', 'core');
             $configuration = self::getCache()->fileGet(Cache::KEY_CONFIGURATION, false);
         }
     }
     if (!self::isReadySetup() || !$configuration) {
         Logging::log('Loading configuration from files', 'core');
         $config_filename = \THEBUGGENIE_CONFIGURATION_PATH . "settings.yml";
         $b2db_filename = \THEBUGGENIE_CONFIGURATION_PATH . "b2db.yml";
         if (!file_exists($config_filename)) {
             throw new \Exception("The configuration file ({$config_filename} does not exist.");
         }
         $config = \Spyc::YAMLLoad($config_filename);
         $b2db_config = \Spyc::YAMLLoad($b2db_filename);
         $configuration = array_merge($config, $b2db_config);
         if (self::isReadySetup()) {
             self::getCache()->fileAdd(Cache::KEY_CONFIGURATION, $configuration, false);
             self::getCache()->add(Cache::KEY_CONFIGURATION, $configuration, false);
         }
     }
     self::$_configuration = $configuration;
     self::$_debug_mode = self::$_configuration['core']['debug'];
     Logging::log('...done', 'core');
 }
Example #2
0
 protected static function loadConfiguration()
 {
     Logging::log('Loading configuration from cache', 'core');
     if (self::isReadySetup()) {
         $configuration = self::getCache()->get(Cache::KEY_CONFIGURATION, false);
         if (!$configuration) {
             Logging::log('Loading configuration from disk cache', 'core');
             $configuration = self::getCache()->fileGet(Cache::KEY_CONFIGURATION, false);
         }
     }
     if (!self::isReadySetup() || !$configuration) {
         Logging::log('Loading configuration from files', 'core');
         $config_filename = \THEBUGGENIE_CONFIGURATION_PATH . "settings.yml";
         $b2db_filename = \THEBUGGENIE_CONFIGURATION_PATH . "b2db.yml";
         if (!file_exists($config_filename)) {
             throw new \Exception("The configuration file ({$config_filename} does not exist.");
         }
         $config = \Spyc::YAMLLoad($config_filename);
         $b2db_config = \Spyc::YAMLLoad($b2db_filename);
         $configuration = array_merge($config, $b2db_config);
         if (self::isReadySetup()) {
             self::getCache()->fileAdd(Cache::KEY_CONFIGURATION, $configuration, false);
             self::getCache()->add(Cache::KEY_CONFIGURATION, $configuration, false);
         }
     }
     self::$_configuration = $configuration;
     self::$_debug_mode = self::$_configuration['core']['debug'];
     $log_file = self::$_configuration['core']['log_file'];
     if ($log_file) {
         Logging::setLogFilePath($log_file);
         Logging::log('Log file path set. At this point, configuration is loaded & caching enabled, if possible.', 'core');
     }
     Logging::log('Done Loading Configuration', 'core');
 }