[TASK] Follow-up to TCA refactoring 43/18543/2
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 28 Feb 2013 20:56:49 +0000 (21:56 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 28 Feb 2013 21:03:20 +0000 (22:03 +0100)
The patch adapts some minor nitpicks raised during review
of the main TCA patch. Most changes are comments together
with a small restriction to Configuration/TCA/*.php files
for the first cache layer and an according test adaption.

Change-Id: Idc9daead910b4ab0cbf60e7f031450efa1f68928
Resolves: #45927
Related: #45767
Releases: 6.1
Reviewed-on: https://review.typo3.org/18543
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/backend/Classes/Utility/IconUtility.php
typo3/sysext/cms/ext_tables.php
typo3/sysext/cms/tslib/index_ts.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionMangementUtilityTest.php

index 9e2a898..2f6c93c 100644 (file)
@@ -705,7 +705,7 @@ class IconUtility {
         * statuses, used for overlays.
         * You should not use this directly besides if you need classes for ExtJS iconCls.
         *
-        * see ext:core/Configuration/TCA/Pages.php for an example with the TCA table "pages"
+        * see ext:core/Configuration/TCA/pages.php for an example with the TCA table "pages"
         *
         * @param string $table The TCA table
         * @param array $row The selected record
@@ -727,7 +727,7 @@ class IconUtility {
         * statuses, used for overlays.
         * You should not use this directly besides if you need it in tceforms/core classes
         *
-        * see ext:core/Configuration/TCA/Pages.php for an example with the TCA table "pages"
+        * see ext:core/Configuration/TCA/pages.php for an example with the TCA table "pages"
         *
         * @param string $tableThe TCA table
         * @param array $row The selected record
@@ -940,4 +940,4 @@ class IconUtility {
 }
 
 
-?>
\ No newline at end of file
+?>
index af417fd..79ef168 100755 (executable)
@@ -24,7 +24,7 @@ if (!function_exists('user_sortPluginList')) {
 if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard']) || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard'], 'tt_content:image')) && !\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('6.0')) {
        \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('This installation hasn\'t been migrated to FAL for the field $TCA[tt_content][columns][image] yet. Please do so before TYPO3 v7.');
        // Existing installation and no upgrade wizard was executed - and files haven't been merged: use the old code
-       $TCA['tt_content']['columns']['image']['config'] = array(
+       $GLOBALS['TCA']['tt_content']['columns']['image']['config'] = array(
                'type' => 'group',
                'internal_type' => 'file',
                'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
@@ -41,7 +41,7 @@ if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Upd
 if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard']) || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard'], 'tt_content:media')) && !\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('6.0')) {
        \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('This installation hasn\'t been migrated to FAL for the field $TCA[tt_content][columns][media] yet. Please do so before TYPO3 v7.');
        // Existing installation and no upgrade wizard was executed - and files haven't been merged: use the old code
-       $TCA['tt_content']['columns']['media']['config'] = array(
+       $GLOBALS['TCA']['tt_content']['columns']['media']['config'] = array(
                'type' => 'group',
                'internal_type' => 'file',
                'allowed' => '',
@@ -62,7 +62,7 @@ if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Upd
 if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard']) || !\TYPO3\CMS\Core\Utility\GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Updates_File_TceformsUpdateWizard'], 'pages_language_overlay:media')) && !\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('6.0')) {
        \TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog('This installation hasn\'t been migrated to FAL for the field $TCA[pages_language_overlay][columns][media] yet. Please do so before TYPO3 v7.');
        // Existing installation and no upgrade wizard was executed - and files haven't been merged: use the old code
-       $TCA['pages_language_overlay']['columns']['media']['config'] = array(
+       $GLOBALS['TCA']['pages_language_overlay']['columns']['media']['config'] = array(
                'type' => 'group',
                'internal_type' => 'file',
                'allowed' => $TCA['pages']['columns']['media']['config']['allowed'],
@@ -74,4 +74,4 @@ if ((!isset($GLOBALS['TYPO3_CONF_VARS']['INSTALL']['wizardDone']['Tx_Install_Upd
                'minitems' => '0'
        );
 }
-?>
\ No newline at end of file
+?>
index f463098..1c3dabb 100644 (file)
@@ -142,7 +142,7 @@ if ($TSFE->isBackendUserLoggedIn()) {
                $BE_USER->frontendEdit->initConfigOptions();
        }
 } else {
-       \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca(TRUE);
+       \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->loadCachedTca();
 }
 
 // Starts the template
index 6047295..e20f5b6 100644 (file)
@@ -625,7 +625,7 @@ class Bootstrap {
 
        /**
         * Unsetting reserved global variables:
-        * Those which are/can be set in "ext:core/ext_tables.php" file:
+        * Those are set in "ext:core/ext_tables.php" file:
         *
         * @return \TYPO3\CMS\Core\Core\Bootstrap
         */
index 2522789..f44ec52 100644 (file)
@@ -1645,7 +1645,12 @@ tt_content.' . $key . $prefix . ' {
                        if (is_dir($tcaConfigurationDirectory)) {
                                $files = scandir($tcaConfigurationDirectory);
                                foreach ($files as $file) {
-                                       if (is_file($tcaConfigurationDirectory . '/' . $file) && ($file !== '.') && ($file !== '..')) {
+                                       if (
+                                               is_file($tcaConfigurationDirectory . '/' . $file)
+                                               && ($file !== '.')
+                                               && ($file !== '..')
+                                               && (substr($file, -4, 4) === '.php')
+                                       ) {
                                                $tcaOfTable = require($tcaConfigurationDirectory . '/' . $file);
                                                if (is_array($tcaOfTable)) {
                                                        // TCA table name is filename without .php suffix, eg 'sys_notes', not 'sys_notes.php'
@@ -1786,8 +1791,12 @@ tt_content.' . $key . $prefix . ' {
         * $TCA[$tableName]['ctrl']['dynamicConfigFile'] must be the
         * absolute path to a file.
         *
+        * Be aware that 'dynamicConfigFile' is obsolete, and all TCA
+        * table definitions should be moved to Configuration/TCA/tablename.php
+        * to be fully loaded automatically.
+        *
         * Example:
-        * dynamicConfigFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Configuration/TCA/SysNote.php',
+        * dynamicConfigFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'SysNote.php',
         *
         * @return void
         * @throws \RuntimeException
@@ -1796,7 +1805,7 @@ tt_content.' . $key . $prefix . ' {
        static public function loadNewTcaColumnsConfigFiles() {
                global $TCA;
 
-               foreach ($TCA as $tableName => $configuration) {
+               foreach (array_keys($TCA) as $tableName) {
                        if (!isset($TCA[$tableName]['columns'])) {
                                $columnsConfigFile = $TCA[$tableName]['ctrl']['dynamicConfigFile'];
                                if ($columnsConfigFile) {
index 3d5f6c6..c4bd277 100644 (file)
@@ -870,7 +870,7 @@ throw new \RuntimeException(\'\', 1340559079);
        /**
         * @test
         */
-       public function loadBaseTcaCreatesCacheFileWithContentOfAnExtensionsConfigurationTcaFile() {
+       public function loadBaseTcaCreatesCacheFileWithContentOfAnExtensionsConfigurationTcaPhpFile() {
                $extensionName = uniqid('test_baseTca_');
                $this->fakedExtensions[] = $extensionName;
                $absoluteExtPath = PATH_site . 'typo3temp/' . $extensionName . '/';
@@ -885,7 +885,7 @@ throw new \RuntimeException(\'\', 1340559079);
                $uniqueTableName = uniqid('table_name_');
                $uniqueStringInTableConfiguration = uniqid('table_configuration_');
                $tableConfiguration = '<?php return array(\'foo\' => \'' . $uniqueStringInTableConfiguration . '\'); ?>';
-               file_put_contents($absoluteExtPath . 'Configuration/TCA/' . $uniqueTableName, $tableConfiguration);
+               file_put_contents($absoluteExtPath . 'Configuration/TCA/' . $uniqueTableName . '.php', $tableConfiguration);
                $mockCache = $this->getMock(
                        'TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend',
                        array('getIdentifier', 'set', 'get', 'getByTag', 'has', 'remove', 'flush', 'flushByTag', 'requireOnce'),
@@ -1408,4 +1408,4 @@ throw new \RuntimeException(\'\', 1340559079);
        }
 
 }
-?>
\ No newline at end of file
+?>