[!!!][TASK] Remove deprecated usage of 'static_lang_isocode' 47/48847/6
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 7 Jul 2016 19:36:03 +0000 (21:36 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 8 Jul 2016 15:54:48 +0000 (17:54 +0200)
Remove another usage of static_lang_isocode within FormEngine code.
This field was deprecated in v7 and came along with an update wizard,
it has been marked as breaking in an 8.0 .rst file already.
There are further usages of this field that are harder to remove,
those can be done with other dedicated patches.

Change-Id: Ic6f52124d244b418802f63d148bbc89743c7cec9
Resolves: #76992
Releases: master
Reviewed-on: https://review.typo3.org/48847
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
typo3/sysext/backend/Classes/Form/FormDataProvider/DatabaseSystemLanguageRows.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/DatabaseSystemLanguageRowsTest.php

index 10f26d4..817023d 100644 (file)
@@ -15,11 +15,9 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider;
  */
 
 use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
-use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
 
@@ -72,7 +70,7 @@ class DatabaseSystemLanguageRows implements FormDataProviderInterface
         ];
 
         $dbRows = $database->exec_SELECTgetRows(
-            'uid,title,language_isocode,static_lang_isocode,flag',
+            'uid,title,language_isocode,flag',
             'sys_language',
             'pid=0'
         );
@@ -84,7 +82,6 @@ class DatabaseSystemLanguageRows implements FormDataProviderInterface
             );
         }
 
-        $isStaticInfoTablesLoaded = ExtensionManagementUtility::isLoaded('static_info_tables');
         foreach ($dbRows as $dbRow) {
             $uid = $dbRow['uid'];
             $languageRows[$uid] = [
@@ -94,15 +91,6 @@ class DatabaseSystemLanguageRows implements FormDataProviderInterface
             ];
             if (!empty($dbRow['language_isocode'])) {
                 $languageRows[$uid]['iso'] = $dbRow['language_isocode'];
-            } elseif ($isStaticInfoTablesLoaded && !empty($dbRow['static_lang_isocode'])) {
-                GeneralUtility::deprecationLog(
-                    'Usage of the field "static_lang_isocode" is discouraged, and will stop working with CMS 8. Use the built-in'
-                    . ' language field "language_isocode" in your sys_language records.'
-                );
-                $lg_iso_2 = BackendUtility::getRecord('static_languages', $dbRow['static_lang_isocode'], 'lg_iso_2');
-                if ($lg_iso_2['lg_iso_2']) {
-                    $languageRows[$uid]['iso'] = $lg_iso_2['lg_iso_2'];
-                }
             } else {
                 // No iso code could be found. This is currently possible in the system but discouraged.
                 // So, code within FormEngine has to be suited to work with an empty iso code. However,
index 31dac17..70959a3 100644 (file)
@@ -22,7 +22,6 @@ use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Tests\UnitTestCase;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
 
@@ -180,7 +179,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
                 'flag' => 'fr',
             ],
         ];
-        $this->dbProphecy->exec_SELECTgetRows('uid,title,language_isocode,static_lang_isocode,flag', 'sys_language', 'pid=0')->willReturn($dbRows);
+        $this->dbProphecy->exec_SELECTgetRows('uid,title,language_isocode,flag', 'sys_language', 'pid=0')->willReturn($dbRows);
         $expected = [
             'systemLanguageRows' => [
                 -1 => [
@@ -209,52 +208,6 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
     /**
      * @test
      */
-    public function addDataResolvesLanguageIsocodeFromStaticInfoTable()
-    {
-        if (ExtensionManagementUtility::isLoaded('static_info_tables') === false) {
-            $this->markTestSkipped('no ext:static_info_tables available');
-        }
-        $dbRows = [
-            [
-                'uid' => 3,
-                'title' => 'french',
-                'language_isocode' => '',
-                'static_lang_isocode' => 42,
-                'flag' => 'fr',
-            ],
-        ];
-        $this->dbProphecy->exec_SELECTgetRows('uid,title,language_isocode,static_lang_isocode,flag', 'sys_language', 'pid=0')->shouldBeCalled()->willReturn($dbRows);
-        // Needed for backendUtility::getRecord()
-        $GLOBALS['TCA']['static_languages'] = [ 'foo' ];
-        $this->dbProphecy->exec_SELECTgetSingleRow('lg_iso_2', 'static_languages', 'uid=42')->shouldBeCalled()->willReturn([ 'lg_iso_2' => 'FR' ]);
-        $expected = [
-            'systemLanguageRows' => [
-                -1 => [
-                    'uid' => -1,
-                    'title' => 'LLL:EXT:lang/locallang_mod_web_list.xlf:multipleLanguages',
-                    'iso' => 'DEF',
-                    'flagIconIdentifier' => 'flags-multiple',
-                ],
-                0 => [
-                    'uid' => 0,
-                    'title' => 'LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage',
-                    'iso' => 'DEF',
-                    'flagIconIdentifier' => 'empty-empty',
-                ],
-                3 => [
-                    'uid' => 3,
-                    'title' => 'french',
-                    'flagIconIdentifier' => 'flags-fr',
-                    'iso' => 'FR',
-                ],
-            ],
-        ];
-        $this->assertSame($expected, $this->subject->addData([]));
-    }
-
-    /**
-     * @test
-     */
     public function addDataAddFlashMessageWithMissingIsoCode()
     {
         $dbRows = [
@@ -266,7 +219,7 @@ class DatabaseSystemLanguageRowsTest extends UnitTestCase
                 'flag' => 'fr',
             ],
         ];
-        $this->dbProphecy->exec_SELECTgetRows('uid,title,language_isocode,static_lang_isocode,flag', 'sys_language', 'pid=0')->shouldBeCalled()->willReturn($dbRows);
+        $this->dbProphecy->exec_SELECTgetRows('uid,title,language_isocode,flag', 'sys_language', 'pid=0')->shouldBeCalled()->willReturn($dbRows);
         // Needed for backendUtility::getRecord()
         $GLOBALS['TCA']['static_languages'] = [ 'foo' ];
         $expected = [