From 97031c0c46ea1b694b738a55a6337ba24e2ffd46 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 8 Nov 2012 22:42:13 +0000 Subject: [PATCH] Fixes for installation phase --- .gitattributes | 1 + inc/ajax/ajax_installer.php | 6 ++-- inc/db/lib-mysql3.php | 11 +++--- inc/install-functions.php | 36 ++++++++++++++----- inc/language/install_de.php | 6 ++-- templates/de/html/install/install_header.tpl | 1 + templates/de/html/install/install_page2.tpl | 2 +- .../install/install_page_database_config.tpl | 6 ++-- 8 files changed, 47 insertions(+), 22 deletions(-) create mode 100644 templates/de/html/install/install_header.tpl diff --git a/.gitattributes b/.gitattributes index b758bbec43..a1f294a5e6 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1816,6 +1816,7 @@ templates/de/html/install/install_fatal_row.tpl svneol=native#text/plain templates/de/html/install/install_fatal_table.tpl svneol=native#text/plain templates/de/html/install/install_finished.tpl svneol=native#text/plain templates/de/html/install/install_footer.tpl svneol=native#text/plain +templates/de/html/install/install_header.tpl -text templates/de/html/install/install_main_ajax.tpl svneol=native#text/plain templates/de/html/install/install_main_plain.tpl svneol=native#text/plain templates/de/html/install/install_menu.tpl svneol=native#text/plain diff --git a/inc/ajax/ajax_installer.php b/inc/ajax/ajax_installer.php index d6041f458c..f6fd6e7811 100644 --- a/inc/ajax/ajax_installer.php +++ b/inc/ajax/ajax_installer.php @@ -333,10 +333,10 @@ function doAjaxPrepareInstallerDatabaseConfig () { setSession('mysql_pass2', ''); } // END - if - // Is 'mysql_type' not set? - if (!isSessionVariableSet('mysql_type')) { + // Is 'mysql_engine' not set? + if (!isSessionVariableSet('mysql_engine')) { // Then set it directly - setSession('mysql_type', 'MyISAM'); + setSession('mysql_engine', 'MyISAM'); } // END - if } diff --git a/inc/db/lib-mysql3.php b/inc/db/lib-mysql3.php index d586a0aebe..8715bc7b4a 100644 --- a/inc/db/lib-mysql3.php +++ b/inc/db/lib-mysql3.php @@ -718,7 +718,7 @@ function getLastSqlError () { } // Gets an array (or false if none is found) from all supported engines -function getArrayFromSupportedSqlEngines ($support = 'YES') { +function getArrayFromSupportedSqlEngines ($requestedEngine = 'ALL') { // Init array $engines = array(); @@ -726,16 +726,19 @@ function getArrayFromSupportedSqlEngines ($support = 'YES') { $result = SQL_QUERY('SHOW ENGINES', __FUNCTION__, __LINE__); // Are there entries? (Bad if not) - if (SQL_NUMROWS($result) > 0) { + if (!SQL_HASZERONUMS($result)) { // Load all and check for active entries while ($content = SQL_FETCHARRAY($result)) { + // Debug message + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'support=' . $requestedEngine . ',Engine=' . $content['Engine'] . ',Support=' . $content['Support']); + // Is this supported? - if (($support == 'ALL') || ($content['Support'] == $support)) { + if ((($requestedEngine == 'ALL') || ($content['Engine'] == $requestedEngine)) && (in_array($content['Support'], array('YES', 'DEFAULT')))) { // Add it array_push($engines, $content); } elseif (isDebugModeEnabled()) { // Log it away in debug mode - logDebugMessage(__FUNCTION__, __LINE__, 'Engine ' . $content['Engine'] . ' is not supported (' . $content['Supported'] . ' - ' . $support . ')'); + logDebugMessage(__FUNCTION__, __LINE__, 'Engine ' . $content['Engine'] . ' is not supported (' . $content['Supported'] . ' - ' . $requestedEngine . ')'); } } // END - if } else { diff --git a/inc/install-functions.php b/inc/install-functions.php index 8ef45388ab..0b5152c99c 100644 --- a/inc/install-functions.php +++ b/inc/install-functions.php @@ -54,7 +54,7 @@ function initInstaller () { 'mysql_host' => 'database_config', 'mysql_dbase' => 'database_config', 'mysql_prefix' => 'database_config', - 'mysql_type' => 'database_config', + 'mysql_engine' => 'database_config', 'mysql_login' => 'database_config', 'mysql_password1' => 'database_config', 'mysql_password2' => 'database_config', @@ -179,7 +179,7 @@ function generateInstallerDatabaseTypeOptions () { '/ARRAY/', array('MyISAM', 'InnoDB'), array('{--INSTALLER_TABLE_TYPE_MYISAM--}', '{--INSTALLER_TABLE_TYPE_INNODB--}'), - getSession('mysql_type') + getSession('mysql_engine') ); } @@ -401,7 +401,7 @@ function isInstallerMysqlHostValid ($value) { return $isValid; } -// Call-back function to check validity of 'mysql_type' +// Call-back function to check validity of 'mysql_engine' function isInstallerMysqlTypeValid ($value) { // This value must be 'MyISAM' or 'InnoDB' $isValid = in_array($value, array('MyISAM', 'InnoDB')); @@ -459,6 +459,11 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { // Could not find database $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_SELECT_FAILED--}'; array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_dbase'); + + // Disconnect here, we don't need idle database connections laying around + SQL_CLOSE(__FUNCTION__, __LINE__); + + // Abort here return FALSE; } // END - if @@ -467,18 +472,28 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { setConfigEntry('_MYSQL_PREFIX', postRequestElement('mysql_prefix')); // Get an array of all supported engines - $engines = getArrayFromSupportedSqlEngines(); + $engines = getArrayFromSupportedSqlEngines(postRequestElement('mysql_engine')); // Is this an array? if (!is_array($engines)) { // Something bad happened $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_ENGINES_SQL_ERROR--}'; - array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type'); + array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine'); + + // Disconnect here, we don't need idle database connections laying around + SQL_CLOSE(__FUNCTION__, __LINE__); + + // Abort here return FALSE; } elseif (count($engines) == 0) { // No engine is active $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_NO_ENGINES_ACTIVE--}'; - array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type'); + array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine'); + + // Disconnect here, we don't need idle database connections laying around + SQL_CLOSE(__FUNCTION__, __LINE__); + + // Abort here return FALSE; } @@ -488,7 +503,7 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { $engineValid = FALSE; // Is the engine there? - if (strtolower($engineArray['Engine']) == strtolower(postRequestElement('mysql_type'))) { + if (strtolower($engineArray['Engine']) == strtolower(postRequestElement('mysql_engine'))) { // Okay, engine is found $engineValid = TRUE; break; @@ -499,7 +514,12 @@ function isInstallerPostDatabaseConfigValid ($currentTab) { if ($engineValid === FALSE) { // Requested engine is not active $GLOBALS['installer_post_error'][$currentTab] = '{--INSTALLER_POST_DATABASE_ENGINE_UNSUPPORTED--}'; - array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_type'); + array_push($GLOBALS['installer_failed_fields'][$currentTab], 'mysql_engine'); + + // Disconnect here, we don't need idle database connections laying around + SQL_CLOSE(__FUNCTION__, __LINE__); + + // Abort here return FALSE; } // END - if diff --git a/inc/language/install_de.php b/inc/language/install_de.php index a392326f63..c3cfb87c00 100644 --- a/inc/language/install_de.php +++ b/inc/language/install_de.php @@ -103,8 +103,8 @@ addMessages(array( 'INSTALLER_MYSQL_HOST' => "Server-Hostname:", 'INSTALLER_MYSQL_DBASE' => "Datenbank:", 'INSTALLER_MYSQL_PREFIX' => "Präfix für alle Tabellen:", - 'INSTALLER_MYSQL_TABLE_TYPE' => "Tabellentyp:", - 'INSTALLER_MYSQL_TABLE_TYPE_NOTICE' => "MyISAM ist meistens ausreichend.", + 'INSTALLER_MYSQL_ENGINE' => "Tabellentyp:", + 'INSTALLER_MYSQL_ENGINE_NOTICE' => "MyISAM ist meistens ausreichend.", 'INSTALLER_TABLE_TYPE_MYISAM' => "MyISAM (langsamer, da Tabelle gelockt wird)", 'INSTALLER_TABLE_TYPE_INNODB' => "InnoDB (schneller, da zweilenweis gelockt wird)", 'INSTALLER_MYSQL_LOGIN' => "Ihr Loginname:", @@ -169,7 +169,7 @@ addMessages(array( 'INSTALLER_CHANGED_ELEMENT_MYSQL_HOST' => "Sie haben den Hostnamen für die Datenbankverbindung geändert.", 'INSTALLER_CHANGED_ELEMENT_MYSQL_DBASE' => "Sie haben den Datenbanknamen für die Datenbankverbindung geändert.", 'INSTALLER_CHANGED_ELEMENT_MYSQL_PREFIX' => "Sie haben den Tabellenpräfix für die Datenbankverbindung geändert.", - 'INSTALLER_CHANGED_ELEMENT_MYSQL_TYPE' => "Sie haben den Tabellentyp für die Datenbankverbindung geändert.", + 'INSTALLER_CHANGED_ELEMENT_MYSQL_ENGINE' => "Sie haben die Datenbank-Engine für die Datenbankverbindung geändert.", 'INSTALLER_CHANGED_ELEMENT_MYSQL_LOGIN' => "Sie haben den Login für die Datenbankverbindung geändert.", 'INSTALLER_CHANGED_ELEMENT_MYSQL_PASSWORD1' => "Sie haben das Passwort für die Datenbankverbindung geändert.", 'INSTALLER_CHANGED_ELEMENT_MYSQL_PASSWORD2' => "Sie haben die Passwortwiederholung für die Datenbankverbindung geändert.", diff --git a/templates/de/html/install/install_header.tpl b/templates/de/html/install/install_header.tpl new file mode 100644 index 0000000000..11f5d85d80 --- /dev/null +++ b/templates/de/html/install/install_header.tpl @@ -0,0 +1 @@ + diff --git a/templates/de/html/install/install_page2.tpl b/templates/de/html/install/install_page2.tpl index 63e66ccfa3..92e29759f2 100644 --- a/templates/de/html/install/install_page2.tpl +++ b/templates/de/html/install/install_page2.tpl @@ -30,7 +30,7 @@ - {--INSTALLER_MYSQL_TABLE_TYPE--} + {--INSTALLER_MYSQL_ENGINE--} + +
- {--INSTALLER_MYSQL_TABLE_TYPE_NOTICE--} + {--INSTALLER_MYSQL_ENGINE_NOTICE--}
-- 2.39.5