[!!!][TASK] Deprecate typo3conf/extTables.php functionality 35/37235/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 22 May 2015 16:29:55 +0000 (18:29 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 22 May 2015 17:42:48 +0000 (19:42 +0200)
Using typo3conf/extTables.php for TCA overrides is bad practice.
Nowadays, stuff like that should reside in an extension that
uses Configuration/TCA/Overrides.

The patch deprecates the according parameters and logs if
an instance still has an typo3conf/extTables.php file.

The functionality within lowlevel "Configuration" backend
module to write overrides to this file is removed.

Change-Id: I648b985de4636c6af2cfb50bf8e106c472cb0fee
Releases: master
Resolves: #65344
Reviewed-on: http://review.typo3.org/37235
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Configuration/FactoryConfiguration.php
typo3/sysext/core/Documentation/Changelog/7.1/Breaking-64226-OptionAccessListRenderModeRemoved.rst
typo3/sysext/core/Documentation/Changelog/master/Deprecation-65344-ExtTables.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/DataHandling/AbstractDataHandlerActionTestCase.php
typo3/sysext/lowlevel/Classes/View/ConfigurationView.php
typo3/sysext/lowlevel/Resources/Private/Templates/Backend/Configuration.html

index 24297f9..c2829cb 100644 (file)
@@ -555,6 +555,7 @@ class Bootstrap {
                define('TYPO3_db_username', $GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
                define('TYPO3_db_password', $GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
                define('TYPO3_db_host', $GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
+               // Constant TYPO3_extTableDef_script is deprecated since TYPO3 CMS 7 and will be dropped with TYPO3 CMS 8
                define('TYPO3_extTableDef_script',
                        isset($GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript'])
                        ? $GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']
@@ -1062,9 +1063,7 @@ class Bootstrap {
         * $TBE_MODULES directly, but we can not prohibit
         * this without heavily breaking backwards compatibility.
         *
-        * @TODO : We could write a scheduler / reports module or an update checker
-        * @TODO : It should be defined, which global arrays are ok to be manipulated
-        *
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         * @return void
         */
        protected function executeExtTablesAdditionalFile() {
@@ -1077,6 +1076,10 @@ class Bootstrap {
                // Load additional ext tables script if the file exists
                $extTablesFile = PATH_typo3conf . TYPO3_extTableDef_script;
                if (file_exists($extTablesFile) && is_file($extTablesFile)) {
+                       Utility\GeneralUtility::deprecationLog(
+                               'Using typo3conf/' . TYPO3_extTableDef_script . ' is deprecated and will be removed with TYPO3 CMS 8. Please move your TCA overrides'
+                               . ' to Configuration/TCA/Overrides of your project specific extension, or slot the signal "tcaIsBeingBuilt" for further processing.'
+                       );
                        include $extTablesFile;
                }
        }
index a65908f..c562387 100644 (file)
@@ -10,9 +10,6 @@ return array(
                'explicitADmode' => 'explicitAllow',
                'loginSecurityLevel' => 'rsa',
        ),
-       'DB' => array(
-               'extTablesDefinitionScript' => 'extTables.php',
-       ),
        'EXT' => array(
                'extConf' => array(
                        'rsaauth' => 'a:1:{s:18:"temporaryDirectory";s:0:"";}',
index 7115fea..f3d3e3d 100644 (file)
@@ -28,7 +28,7 @@ Migration
 =========
 
 Choose between the default value ``checkbox`` (no change required then) or set the following values inside the
-file ``typo3conf/extTables.php`` to the option of your needs.
+``Configuration/TCA/Overrides`` files of your project specific extension to the option of your needs.
 
 .. code-block:: php
 
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65344-ExtTables.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65344-ExtTables.rst
new file mode 100644 (file)
index 0000000..ae2034e
--- /dev/null
@@ -0,0 +1,31 @@
+========================================================
+Deprecation: #65344 - typo3conf/extTables.php deprecated
+========================================================
+
+Description
+===========
+
+The file ``typo3conf/extTables.php`` which could be used for local TCA modifications is deprecated.
+
+Setting ``$GLOBALS['TYPO3_CONF_VARS']['DB']['extTablesDefinitionScript']`` together with the constant
+``TYPO3_extTableDef_script`` are deprecated and should not be used any longer.
+
+
+Impact
+======
+
+The options and files are typically used for "poor man" ``$GLOBALS['TCA']`` overrides. This is discouraged
+and shouldn't be used any longer.
+
+
+Migration
+=========
+
+There are two options to migrate away from ``typo3conf/extTables.php`` usage, the first one should be preferred:
+
+* It is good practice to have a project / site specific extension that contains templates, TypoScript and
+other stuff. Create one or more dedicated extensions and use TCA overrides to apply the desired modifications.
+Something like ``$GLOBALS['TCA']['pages']['ctrl']['hideAtCopy'] = FALSE;`` should be moved from ``typo3conf/extTables.php``
+to ``typo3conf/ext/<your_extension>/Configuration/TCA/Overrides/pages.php``.
+
+* Slot the signal ``tcaIsBeingBuilt`` that is emitted in ``ExtensionManagementUtility.php``.
\ No newline at end of file
index 1198995..5e77d63 100644 (file)
@@ -47,7 +47,6 @@ abstract class AbstractDataHandlerActionTestCase extends \TYPO3\CMS\Core\Tests\F
         */
        protected $testExtensionsToLoad = array(
                'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
-               // 'typo3conf/ext/datahandler',
        );
 
        /**
index ff10e63..36d9cfb 100644 (file)
@@ -17,9 +17,6 @@ namespace TYPO3\CMS\Lowlevel\View;
 use TYPO3\CMS\Backend\Module\BaseScriptClass;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Messaging\FlashMessage;
-use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
-use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
@@ -39,11 +36,6 @@ class ConfigurationView extends BaseScriptClass {
        protected $view;
 
        /**
-        * @var FlashMessageQueue
-        */
-       protected $flashMessageQueue;
-
-       /**
         * The name of the module
         *
         * @var string
@@ -184,6 +176,7 @@ class ConfigurationView extends BaseScriptClass {
                if ($update) {
                        $this->getBackendUser()->pushModuleData($this->moduleName, $this->MOD_SETTINGS);
                }
+               $arrayBrowser->dontLinkVar = TRUE;
                $arrayBrowser->depthKeys = $this->MOD_SETTINGS['node_' . $this->MOD_SETTINGS['function']];
                $arrayBrowser->regexMode = $this->MOD_SETTINGS['regexsearch'];
                $arrayBrowser->fixedLgd = $this->MOD_SETTINGS['fixedLgd'];
@@ -199,62 +192,6 @@ class ConfigurationView extends BaseScriptClass {
                }
                $tree = $arrayBrowser->tree($theVar, '', '');
                $this->view->assign('tree', $tree);
-               // Variable name:
-               if (GeneralUtility::_GP('varname')) {
-                       $this->view->assign('varname', TRUE);
-                       $line = GeneralUtility::_GP('_') ? GeneralUtility::_GP('_') : GeneralUtility::_GP('varname');
-                       // Write the line to extTables.php
-                       if (GeneralUtility::_GP('writetoexttables')) {
-                               // change value to $GLOBALS
-                               $length = strpos($line, '[');
-                               $var = substr($line, 0, $length);
-                               $changedLine = '$GLOBALS[\'' . substr($line, 1, ($length - 1)) . '\']' . substr($line, $length);
-                               // load current extTables.php
-                               $extTables = GeneralUtility::getUrl(PATH_typo3conf . TYPO3_extTableDef_script);
-                               if ($var === '$TCA') {
-                                       // check if we are editing the TCA
-                                       preg_match_all('/\\[\'([^\']+)\'\\]/', $line, $parts);
-                               }
-                               // insert line in extTables.php
-                               $extTables = preg_replace('/<\\?php|\\?>/is', '', $extTables);
-                               $extTables = '<?php' . (empty($extTables) ? LF : '') . $extTables . $changedLine . LF . '?>';
-                               $success = GeneralUtility::writeFile(PATH_typo3conf . TYPO3_extTableDef_script, $extTables);
-                               if ($success) {
-                                       // show flash message
-                                       $flashMessage = GeneralUtility::makeInstance(
-                                               FlashMessage::class,
-                                               '',
-                                               sprintf(
-                                                       LocalizationUtility::translate('writeMessage', 'lowlevel'),
-                                                       TYPO3_extTableDef_script,
-                                                       '<br />',
-                                                       '<strong>' . nl2br(htmlspecialchars($changedLine)) . '</strong>'
-                                               ),
-                                               FlashMessage::OK
-                                       );
-                               } else {
-                                       // Error: show flash message
-                                       $flashMessage = GeneralUtility::makeInstance(
-                                               FlashMessage::class,
-                                               '',
-                                               sprintf(LocalizationUtility::translate('writeMessageFailed', 'lowlevel'), TYPO3_extTableDef_script),
-                                               FlashMessage::ERROR
-                                       );
-                               }
-                               $this->getFlashMessageQueue()->enqueue($flashMessage);
-                       }
-
-                       $this->view->assign('line', trim($line));
-
-                       if (TYPO3_extTableDef_script !== '' && ($this->MOD_SETTINGS['function'] === '1' || $this->MOD_SETTINGS['function'] === '4')) {
-                               // write only for $TCA and TBE_STYLES if  TYPO3_extTableDef_script is defined
-                               $this->view->assign('showSaveButton', TRUE);
-                       } else {
-                               $this->view->assign('showSaveButton', FALSE);
-                       }
-               } else {
-                       $this->view->assign('varname', FALSE);
-               }
 
                // Setting up the buttons and markers for docheader
                $docHeaderButtons = $this->getButtons();
@@ -305,17 +242,4 @@ class ConfigurationView extends BaseScriptClass {
                return $funcMenu;
        }
 
-       /**
-        * @return FlashMessageQueue
-        */
-       protected function getFlashMessageQueue() {
-               if (!$this->flashMessageQueue instanceof FlashMessageQueue) {
-                       /** @var $flashMessageService FlashMessageService */
-                       $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
-                       $this->flashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
-               }
-
-               return $this->flashMessageQueue;
-       }
-
 }
index a09ff82..7b7d95a 100644 (file)
        </div>
 </div>
 
-<div id="lowlevel-config-var">
-       <f:if condition="{varname}">
-               <div class="form-group">
-                       <label for="lowlevel-variable">
-                               <f:translate key="variable" />
-                       </label>
-                       <input id="lowlevel-variable" class="form-control" type="text" name="_" value="{line}" size="120"/>
-                       <f:if condition="{showSaveButton}">
-                               <f:else>
-                                       <div class="help-block"><f:translate key="copyPaste" /></div>
-                               </f:else>
-                       </f:if>
-               </div>
-               <f:if condition="{showSaveButton}">
-                       <div class="form-group">
-                               <input class="btn btn-default" type="submit" name="writetoexttables" value="{f:translate(key: 'writeValue')}"/>
-                       </div>
-               </f:if>
-       </f:if>
-</div>
-
 <div class="nowrap">
        <f:format.raw>{tree}</f:format.raw>
 </div>
\ No newline at end of file