/** * Load configuration parameters from the database * * This function retrieves all the parameters from the database and merge them with the basis configuration object. * * Parameters that exists in the basis configuration object will be replaced by those that come from the database. * The basis configuration object contains parameters that come from the i-mscp.conf configuration file or any * parameter defined in the {@link environment.php} file. * * @throws iMSCP_Exception * @return void */ protected function loadConfig() { /** @var $pdo PDO */ $pdo = iMSCP_Database::getRawInstance(); if (is_readable(DBCONFIG_CACHE_FILE_PATH)) { if (!$this->config['DEBUG']) { /** @var iMSCP_Config_Handler_Db $dbConfig */ $dbConfig = unserialize(file_get_contents(DBCONFIG_CACHE_FILE_PATH)); $dbConfig->setDb($pdo); } else { @unlink(DBCONFIG_CACHE_FILE_PATH); goto FORCE_DBCONFIG_RELOAD; } } else { FORCE_DBCONFIG_RELOAD: // Creating new Db configuration handler. $dbConfig = new iMSCP_Config_Handler_Db($pdo); if (!$this->config['DEBUG'] && PHP_SAPI != 'cli') { @file_put_contents(DBCONFIG_CACHE_FILE_PATH, serialize($dbConfig), LOCK_EX); } } // Merge main configuration object with the dbConfig object $this->config->merge($dbConfig); // Add the dbconfig object into the registry for later use iMSCP_Registry::set('dbConfig', $dbConfig); }
require_once LIBRARY_PATH . '/Functions/Shared.php'; require_once LIBRARY_PATH . '/Functions/SoftwareInstaller.php'; require_once LIBRARY_PATH . '/Functions/Reseller.php'; require_once LIBRARY_PATH . '/Functions/View.php'; require_once LIBRARY_PATH . '/vendor/idna_convert/idna_convert.class.php'; /** @var $config iMSCP_Config_Handler_File */ if (is_readable(CONFIG_CACHE_FILE_PATH)) { $config = unserialize(file_get_contents(CONFIG_CACHE_FILE_PATH)); clearstatcache(true, CONFIG_FILE_PATH); if ($config['DEBUG'] || filemtime(CONFIG_FILE_PATH) !== $config['__filemtime__']) { @unlink(CONFIG_CACHE_FILE_PATH); goto FORCE_CONFIG_RELOAD; } } else { FORCE_CONFIG_RELOAD: $config = new iMSCP_Config_Handler_File(CONFIG_FILE_PATH); // Template root directory $config['ROOT_TEMPLATE_PATH'] = dirname(__DIR__) . '/themes/' . $config['USER_INITIAL_THEME']; // Set the isp logos path $config['ISP_LOGO_PATH'] = '/ispLogos'; $config['HTML_CHECKED'] = ' checked'; $config['HTML_DISABLED'] = ' disabled'; $config['HTML_READONLY'] = ' readonly'; $config['HTML_SELECTED'] = ' selected'; // Default Language (if not overriden by admin) $config['USER_INITIAL_LANG'] = 'auto'; // Tell whether or not output must be compressed $config['COMPRESS_OUTPUT'] = 1; // show GZIP compression information in HTML output $config['SHOW_COMPRESSION_SIZE'] = 1; // Session timeout in minutes