/** * @return DataStore */ private static function get_fs_cache() { if (self::$fs_cache === null) { self::$fs_cache = DataStoreFactory::get_filesystem_store(__CLASS__); } return self::$fs_cache; }
private static function get_cache_manager() { if (self::$cache_manager === null) { self::$cache_manager = DataStoreFactory::get_ram_store(__CLASS__); } return self::$cache_manager; }
public static function is_apc_available() { if (self::$apc_available === null) { if (function_exists('apc_cache_info') && (extension_loaded('apc') || extension_loaded('apcu')) && ini_get('apc.enabled')) { self::$apc_available = true; } else { self::$apc_available = false; } } return self::$apc_available; }
private function regenerate_htaccess_file() { $apc_enabled = DataStoreFactory::is_apc_enabled(); if ($apc_enabled) { DataStoreFactory::set_apc_enabled(false); HtaccessFileCache::regenerate(); AppContext::get_cache_service()->clear_cache(); DataStoreFactory::set_apc_enabled(true); } else { AppContext::get_cache_service()->clear_cache(); HtaccessFileCache::regenerate(); } }
public function save_server_environnement_config() { $server_configuration = new ServerConfiguration(); $server_environment_config = ServerEnvironmentConfig::load(); try { if ($server_configuration->has_url_rewriting()) { $server_environment_config->set_url_rewriting_enabled(true); } } catch (UnsupportedOperationException $ex) { $server_environment_config->set_url_rewriting_enabled(false); } if (function_exists('ob_gzhandler') && @extension_loaded('zlib')) { $server_environment_config->set_output_gziping_enabled(true); } if (DataStoreFactory::is_apc_available()) { DataStoreFactory::set_apc_enabled(true); } ServerEnvironmentConfig::save(); }
public static function get_advises(HTMLForm $html_form) { $lang = LangLoader::get('admin-server-common'); $server_configuration = new ServerConfiguration(); $maintenance_config = MaintenanceConfig::load(); $general_config = GeneralConfig::load(); $server_environment_config = ServerEnvironmentConfig::load(); $security_config = SecurityConfig::load(); $url_rewriting_available = false; try { $url_rewriting_available = $server_configuration->has_url_rewriting(); } catch (UnsupportedOperationException $ex) { } $fieldset = new FormFieldsetHTML('advises', $lang['advises']); $fieldset->add_field(new FormFieldFree('modules_management', '', MessageHelper::display($lang['advises.modules_management'], MessageHelper::SUCCESS)->render())); if ($maintenance_config->is_under_maintenance()) { $fieldset->add_field(new FormFieldFree('check_modules_authorizations', '', MessageHelper::display($lang['advises.check_modules_authorizations'], MessageHelper::SUCCESS)->render())); } if (!strstr($general_config->get_site_url(), 'localhost') && !strstr($general_config->get_site_url(), '127.0.0.1') && !$maintenance_config->is_under_maintenance() && Debug::is_debug_mode_enabled()) { $fieldset->add_field(new FormFieldFree('disable_debug_mode', '', MessageHelper::display($lang['advises.disable_debug_mode'], MessageHelper::WARNING)->render())); } if ($url_rewriting_available && !$server_environment_config->is_url_rewriting_enabled()) { $fieldset->add_field(new FormFieldFree('enable_url_rewriting', '', MessageHelper::display($lang['advises.enable_url_rewriting'], MessageHelper::NOTICE)->render())); } if (function_exists('ob_gzhandler') && @extension_loaded('zlib') && !$server_environment_config->is_output_gziping_enabled()) { $fieldset->add_field(new FormFieldFree('enable_output_gz', '', MessageHelper::display($lang['advises.enable_output_gz'], MessageHelper::NOTICE)->render())); } if (DataStoreFactory::is_apc_available() && !DataStoreFactory::is_apc_enabled()) { $fieldset->add_field(new FormFieldFree('enable_apcu_cache', '', MessageHelper::display($lang['advises.enable_apcu_cache'], MessageHelper::NOTICE)->render())); } $fieldset->add_field(new FormFieldFree('save_database', '', MessageHelper::display($lang['advises.save_database'], MessageHelper::SUCCESS)->render())); if (!DatabaseConfig::load()->is_database_tables_optimization_enabled()) { $fieldset->add_field(new FormFieldFree('optimize_database_tables', '', MessageHelper::display($lang['advises.optimize_database_tables'], MessageHelper::SUCCESS)->render())); } if ($security_config->get_internal_password_min_length() == 6 && $security_config->get_internal_password_strength() == SecurityConfig::PASSWORD_STRENGTH_WEAK && !$security_config->are_login_and_email_forbidden_in_password()) { $fieldset->add_field(new FormFieldFree('password_security', '', MessageHelper::display($lang['advises.password_security'], MessageHelper::NOTICE)->render())); } if (ServerConfiguration::get_phpversion() < '5.6') { $fieldset->add_field(new FormFieldFree('upgrade_php_version', '', MessageHelper::display($lang['advises.upgrade_php_version'], MessageHelper::NOTICE)->render())); } if (count($fieldset->get_fields())) { $html_form->add_fieldset($fieldset); } }
protected function save() { if ($this->is_apc_available()) { if ($this->form->get_value('enable_apc')) { DataStoreFactory::set_apc_enabled(true); } else { DataStoreFactory::set_apc_enabled(false); } } if ($this->form->get_value('enable_css_cache')) { $this->css_cache_config->enable(); } else { $this->css_cache_config->disable(); } if (!$this->form->field_is_disabled('level_css_cache')) { $this->css_cache_config->set_optimization_level($this->form->get_value('level_css_cache')->get_raw_value()); } CSSCacheConfig::save(); AppContext::get_cache_service()->clear_css_cache(); }