/** * @desc Check Repository for Update Notification */ private function check_repositories() { if (ServerConfiguration::get_phpversion() > self::PHP_MIN_VERSION_UPDATES) { foreach ($this->apps as $app) { $result = $this->repositories[$app->get_repository()]->check($app); if ($result !== null) { // processing to the update notification $this->add_update_alert($result); } } } }
/** * @static * @desc Installs a module. * @param string $module_identifier Module identifier (name of its folder) * @param bool $enable_module true if you want the module to be enabled, otherwise false. * @return int One of the following error codes: * <ul> * <li>MODULE_INSTALLED: the installation succeded</li> * <li>MODULE_ALREADY_INSTALLED: the module is already installed</li> * <li>UNEXISTING_MODULE: the module you want to install doesn't exist</li> * <li>PHP_VERSION_CONFLICT: the server PHP version is two old to be able to run the module code (config set in the config.ini module file)</li> * <li>CONFIG_CONFLICT: the configuration field is already used</i> * </ul> */ public static function install_module($module_identifier, $enable_module = true, $generate_cache = true) { self::update_class_list(); if (empty($module_identifier) || !is_dir(PATH_TO_ROOT . '/' . $module_identifier)) { return self::UNEXISTING_MODULE; } if (self::is_module_installed($module_identifier)) { return self::MODULE_ALREADY_INSTALLED; } $module = new Module($module_identifier, $enable_module); $configuration = $module->get_configuration(); $phpversion = ServerConfiguration::get_phpversion(); if (version_compare($phpversion, $configuration->get_php_version(), 'lt')) { return self::PHP_VERSION_CONFLICT; } $phpboost_version = GeneralConfig::load()->get_phpboost_major_version(); if (version_compare($phpboost_version, $configuration->get_compatibility(), '>')) { return self::PHPBOOST_VERSION_CONFLICT; } self::execute_module_installation($module_identifier); ModulesConfig::load()->add_module($module); ModulesConfig::save(); // TODO Force initialization ExtensionProviderService for PHPBoost installation AppContext::init_extension_provider_service(); MenuService::add_mini_module($module_identifier, $generate_cache); if ($generate_cache) { MenuService::generate_cache(); if (ServerEnvironmentConfig::load()->is_url_rewriting_enabled()) { HtaccessFileCache::regenerate(); } } return self::MODULE_INSTALLED; }
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); } }
require_once PATH_TO_ROOT . '/admin/admin_begin.php'; define('TITLE', $LANG['administration']); require_once PATH_TO_ROOT . '/admin/admin_header.php'; $check_updates = retrieve(GET, 'check', false); $update_type = retrieve(GET, 'type', ''); if (!in_array($update_type, array('', 'kernel', 'module', 'template'))) { $update_type = ''; } if ($check_updates === true) { AppContext::get_session()->csrf_get_protect(); new Updates(); AppContext::get_response()->redirect('updates.php' . (!empty($update_type) ? '?type=' . $update_type : '')); } $tpl = new FileTemplate('admin/updates/updates.tpl'); $updates_availables = 0; if (ServerConfiguration::get_phpversion() > Updates::PHP_MIN_VERSION_UPDATES) { $update_alerts = AdministratorAlertService::find_by_criteria(null, 'updates'); $updates = array(); foreach ($update_alerts as $update_alert) { // Builds the asked updates (kernel updates, module updates, theme updates or all of them) $update = unserialize($update_alert->get_properties()); if ($update_type == '' || $update->get_type() == $update_type) { if ($update->check_compatibility()) { $updates[] = $update; } else { // Like the update is incompatible (or has been applied) // We set the alert status to processed $update_alert->set_status(Event::EVENT_STATUS_PROCESSED); AdministratorAlertService::save_alert($update_alert); } }
private function chech_php_version() { CLIOutput::writeln("\t" . 'php version'); if (!$this->server_configuration->is_php_compatible()) { CLIOutput::writeln('PHP version (' . ServerConfiguration::get_phpversion() . ') is not compatible with PHPBoost.'); CLIOutput::writeln('PHP ' . ServerConfiguration::MIN_PHP_VERSION . ' is needed!'); return false; } return true; }
/** * @return true if php version fits to phpboost's requirements. */ public function is_php_compatible() { return ServerConfiguration::get_phpversion() >= self::MIN_PHP_VERSION; }