Index: branches/5.2.x/core/install.php
===================================================================
diff -u -N -r14843 -r14860
--- branches/5.2.x/core/install.php (.../install.php) (revision 14843)
+++ branches/5.2.x/core/install.php (.../install.php) (revision 14860)
@@ -1,6 +1,6 @@
Array ('check_paths', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'),
- 'clean_reinstall' => Array ('check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'),
+ 'fresh_install' => Array ('sys_requirements', 'check_paths', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'),
+ 'clean_reinstall' => Array ('install_setup', 'sys_requirements', 'check_paths', 'clean_db', 'db_config', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'sys_config', 'select_theme', 'security', 'finish'),
'already_installed' => Array ('check_paths', 'install_setup'),
'upgrade' => Array ('check_paths', 'install_setup', 'upgrade_modules', 'skin_upgrade', 'security', 'finish'),
'update_license' => Array ('check_paths', 'install_setup', 'select_license', /*'download_license',*/ 'select_domain', 'security', 'finish'),
'update_config' => Array ('check_paths', 'install_setup', 'sys_config', 'security', 'finish'),
'db_reconfig' => Array ('check_paths', 'install_setup', 'db_reconfig', 'security', 'finish'),
+ 'sys_requirements' => Array ('check_paths', 'install_setup', 'sys_requirements', 'security', 'finish')
);
/**
* Steps, that doesn't required admin to be logged-in to proceed
*
* @var Array
*/
- var $skipLoginSteps = Array ('check_paths', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish', -1);
+ var $skipLoginSteps = Array ('sys_requirements', 'check_paths', 'select_license', /*'download_license',*/ 'select_domain', 'root_password', 'choose_modules', 'post_config', 'select_theme', 'security', 'finish', -1);
/**
* Steps, on which kApplication should not be initialized, because of missing correct db table structure
*
* @var Array
*/
- var $skipApplicationSteps = Array ('check_paths', 'clean_db', 'db_config', 'db_reconfig' /*, 'install_setup'*/); // remove install_setup when application will work separately from install
+ var $skipApplicationSteps = Array ('sys_requirements', 'check_paths', 'clean_db', 'db_config', 'db_reconfig' /*, 'install_setup'*/); // remove install_setup when application will work separately from install
/**
* Folders that should be writeable to continue installation. $1 - main writeable folder from config.php ("/system" by default)
@@ -277,6 +278,29 @@
}
switch ($this->currentStep) {
+ case 'sys_requirements':
+ $required_checks = Array (
+ 'php_version', 'curl', 'freetype', 'gd_version',
+ 'jpeg', 'mysql', 'date.timezone', 'output_buffering',
+ );
+
+ $check_results = $this->toolkit->CallPrerequisitesMethod('core/', 'CheckSystemRequirements');
+ $required_checks = array_diff($required_checks, array_keys( array_filter($check_results) ));
+
+ if ( $required_checks ) {
+ // php-based checks failed - show error
+ $this->errorMessage = '
Installation can not continue until all required environment parameters are set correctly';
+ }
+ elseif ( $this->GetVar('js_enabled') === false ) {
+ // can't check JS without form submit - set some fake error, so user stays on this step
+ $this->errorMessage = ' ';
+ }
+ elseif ( !$this->GetVar('js_enabled') || !$this->GetVar('cookies_enabled') ) {
+ // js/cookies disabled
+ $this->errorMessage = '
Installation can not continue until all required environment parameters are set correctly';
+ }
+ break;
+
case 'check_paths':
$writeable_base = $this->toolkit->getSystemConfig('Misc', 'WriteablePath');
foreach ($this->writeableFolders as $folder_path) {
@@ -509,8 +533,11 @@
break;
}
}
- if (!$status) break;
+ if ( !$status ) {
+ break;
+ }
+
// 2. check permissions, that use have in this database
$status = $this->CheckDatabase(($this->currentStep == 'db_config') && !$this->GetVar('UseExistingSetup'));
break;
@@ -1318,8 +1345,8 @@
// perform various check type to database specified
// 1. user is allowed to connect to database
// 2. user has all types of permissions in database
+ // 3. database environment settings met minimum requirements
-
if (mb_strlen($this->toolkit->getSystemConfig('Database', 'TablePrefix')) > 7) {
$this->errorMessage = 'Table prefix should not be longer than 7 characters';
return false;
@@ -1354,6 +1381,22 @@
$this->errorMessage = 'An In-Portal Database already exists at this location';
return false;
}
+
+ $requirements_error = Array ();
+ $db_check_results = $this->toolkit->CallPrerequisitesMethod('core/', 'CheckDBRequirements');
+
+ if ( !$db_check_results['version'] ) {
+ $requirements_error[] = '- MySQL Version is below 5.0';
+ }
+
+ if ( !$db_check_results['packet_size'] ) {
+ $requirements_error[] = '- MySQL Packet Size is below 1 MB';
+ }
+
+ if ( $requirements_error ) {
+ $this->errorMessage = 'Connection successful, but following system requirements were not met:
' . implode('
', $requirements_error);
+ return false;
+ }
}
else {
// user has insufficient permissions in database specified
@@ -1691,7 +1734,7 @@
{
$button_visibility = Array (
'continue' => $this->GetNextStep() != -1 || ($this->stepsPreset == 'already_installed'),
- 'refresh' => in_array($this->currentStep, Array ('check_paths', 'security')),
+ 'refresh' => in_array($this->currentStep, Array ('sys_requirements', 'check_paths', 'security')),
'back' => in_array($this->currentStep, Array (/*'select_license',*/ 'download_license', 'select_domain')),
);