[BUGFIX] Skip CKEditor registration on CLI 81/51981/4
authorChrister Vindberg <cvi@systime.dk>
Wed, 8 Mar 2017 12:14:29 +0000 (13:14 +0100)
committerFrank Nägler <frank.naegler@typo3.org>
Wed, 8 Mar 2017 22:32:17 +0000 (23:32 +0100)
Made sure the CKEditor RequireJS paths are not calculated when running
in a CLI context.

When rte_ckeditor is installed, all caches are cleared
and the first hit to a TYPO3 installation is a CLI command, the
backend RequireJS paths are calculated and saved wrongly
causing the backend to fail afterwards.

How to replicate:

* install rte_ckeditor
* delete var/Cache/
* run typo3/cli_dispatch.phpsh
* visit backend

Resolves: #80183
Releases: master
Change-Id: I5de9462a6f577f2eb6c06adabe44a6a86e3c2592
Reviewed-on: https://review.typo3.org/51981
Reviewed-by: Mathias Brodala <mbrodala@pagemachine.de>
Tested-by: Mathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Anders Kostending <aha@systime.dk>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
typo3/sysext/rte_ckeditor/ext_localconf.php

index 73bc777..b7e1151 100644 (file)
@@ -8,18 +8,20 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'][1480314091] = [
     'class' => \TYPO3\CMS\RteCKEditor\Form\Resolver\RichTextNodeResolver::class,
 ];
 
-\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-    \TYPO3\CMS\Core\Page\PageRenderer::class
-)->addRequireJsConfiguration([
-    'shim' => [
-        'ckeditor' => ['exports' => 'CKEDITOR']
-    ],
-    'paths' => [
-        'ckeditor' => \TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath(
-            \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('rte_ckeditor', 'Resources/Public/JavaScript/Contrib/')
-        ) . 'ckeditor'
-    ]
-]);
+if ((TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) === 0) {
+    \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+        \TYPO3\CMS\Core\Page\PageRenderer::class
+    )->addRequireJsConfiguration([
+        'shim' => [
+            'ckeditor' => ['exports' => 'CKEDITOR']
+        ],
+        'paths' => [
+            'ckeditor' => \TYPO3\CMS\Core\Utility\PathUtility::getAbsoluteWebPath(
+                    \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('rte_ckeditor', 'Resources/Public/JavaScript/Contrib/')
+                ) . 'ckeditor'
+        ]
+    ]);
+}
 
 // Register the presets
 $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'] = 'EXT:rte_ckeditor/Configuration/RTE/Default.yaml';