[BUGFIX] Install Tool: Make ISO language SQL queries DBAL compatible 75/40575/4
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Tue, 23 Jun 2015 20:08:32 +0000 (22:08 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Mon, 20 Jul 2015 13:41:21 +0000 (15:41 +0200)
Use database independent quoting for field values and compare the
numeric static_lang_isocode field with an integer instead of an empty
string.

Resolves: #67707
Related: #61542
Releases: master
Change-Id: I7c7e1352e92598a57524a05c9e048391df63df13
Reviewed-on: http://review.typo3.org/40575
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/install/Classes/Updates/LanguageIsoCodeUpdate.php

index d4c7856..23bacc3 100644 (file)
@@ -37,7 +37,8 @@ class LanguageIsoCodeUpdate extends AbstractUpdate {
                        return FALSE;
                }
 
-               $migratableLanguageRecords = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'sys_language', 'language_isocode="" AND static_lang_isocode!=""');
+               $emptyValue = $this->getDatabaseConnection()->fullQuoteStr('', 'sys_language');
+               $migratableLanguageRecords = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'sys_language', 'language_isocode=' . $emptyValue . ' AND CAST(static_lang_isocode AS CHAR) != ' . $emptyValue);
                if ($migratableLanguageRecords === 0) {
                        return FALSE;
                }
@@ -57,7 +58,8 @@ class LanguageIsoCodeUpdate extends AbstractUpdate {
         * @return bool
         */
        public function performUpdate(array &$databaseQueries, &$customMessages) {
-               $migrateableLanguageRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('uid,static_lang_isocode', 'sys_language', 'language_isocode="" AND static_lang_isocode!=""');
+               $emptyValue =  $this->getDatabaseConnection()->fullQuoteStr('', 'sys_language');
+               $migrateableLanguageRecords = $this->getDatabaseConnection()->exec_SELECTgetRows('uid,static_lang_isocode', 'sys_language', 'language_isocode=' . $emptyValue . ' AND CAST(static_lang_isocode AS CHAR) != ' . $emptyValue);
                if (!empty($migrateableLanguageRecords)) {
                        foreach ($migrateableLanguageRecords as $languageRecord) {
                                $staticLanguageRecord = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'static_languages', 'uid=' . (int)$languageRecord['static_lang_isocode']);