/** * Fetches database/system configuration * Code extracted from vB_Registry::fetch_config (class_core) */ private static function fetch_config() { // Set the default values here. $default['Cache']['class'] = vB_Cache::getDefaults(); // parse the config file if (file_exists(CWD . '/' . self::$config_file)) { include CWD . '/' . self::$config_file; } else { if (defined('STDIN')) { exit(5); } die('<br /><br /><strong>Configuration</strong>: includes/config.php does not exist. For a new install click <a href="core/install/makeconfig.php">here</a>'); } // TODO: this should be handled with an exception, the backend shouldn't produce output if (empty($config)) { // config.php exists, but does not define $config if (defined('STDIN')) { exit(5); } die('<br /><br /><strong>Configuration</strong>: includes/config.php exists, but is not in the 3.6+ format. Please convert your config file via the new config.php.new.'); } self::$config = vB_Array::arrayReplaceRecursive($default, $config); // if a configuration exists for this exact HTTP host, use it if (isset($_SERVER['HTTP_HOST']) and isset(self::$config["{$_SERVER['HTTP_HOST']}"])) { self::$config['MasterServer'] = self::$config["{$_SERVER['HTTP_HOST']}"]; } // define table and cookie prefix constants define('TABLE_PREFIX', trim(isset(self::$config['Database']['tableprefix']) ? self::$config['Database']['tableprefix'] : '')); define('COOKIE_PREFIX', empty(self::$config['Misc']['cookieprefix']) ? 'bb' : self::$config['Misc']['cookieprefix']); // Set debug mode, always default this to false unless it is explicitly set to true (see VBV-2948). self::$config['Misc']['debug'] = (isset(self::$config['Misc']['debug']) and self::$config['Misc']['debug'] === true) ? true : false; // This will not exist if a pre vB5 config file is still in use. @TODO, change the default when everything can cope with a blank setting. if (!isset(self::$config['SpecialUsers']['superadmins'])) { self::$config['SpecialUsers']['superadmins'] = '1'; // Not ideal, but some areas (and the upgrader) choke on a blank setting atm. } }