[TASK] RTEHtmlArea: Remove inclusion of ext_emconf.php 37/48737/3
authorBenni Mack <benni@typo3.org>
Thu, 30 Jun 2016 08:44:34 +0000 (10:44 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Wed, 6 Jul 2016 11:56:24 +0000 (13:56 +0200)
In every request, EXT:rtetmlarea's ext_localconf.php is including
the ext_emconf.php file of the extension to fetch the conflicts (for
EXT:reports) and the rtehtmlarea version, to display in the AboutEditor
plugin of RTEHtmlArea.

The patch changes the version display of the extension to use
the TYPO3 version (which is equivalent to the extension version ATM)
and puts the conflicts check inside the Status Report directly
so it is only used at the places where needed, thus, speeding up every
page request of TYPO3 a bit more.

Resolves: #76880
Releases: master
Change-Id: Ica9fa8856a3057d2cdc3727b060a7df95648209e
Reviewed-on: https://review.typo3.org/48737
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php
typo3/sysext/rtehtmlarea/Classes/Hook/StatusReportConflictsCheckHook.php
typo3/sysext/rtehtmlarea/ext_localconf.php

index 1b6ac40..047e76e 100644 (file)
@@ -612,7 +612,7 @@ class RichTextElement extends AbstractFormElement
                        if (typeof RTEarea === "undefined") {
                                RTEarea = new Object();
                                RTEarea[0] = new Object();
-                               RTEarea[0].version = "' . $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['version'] . '";
+                               RTEarea[0].version = "' . TYPO3_version . '";
                                RTEarea[0].editorUrl = "' . ExtensionManagementUtility::extRelPath('rtehtmlarea') . '";
                                RTEarea[0].editorSkin = "' . $skinDirectory . '/";
                                RTEarea[0].editedContentCSS = "' . $editedContentCSS . '";
index 08a6428..91d04dc 100644 (file)
@@ -45,11 +45,15 @@ class StatusReportConflictsCheckHook implements StatusProviderInterface
      */
     protected function checkIfNoConflictingExtensionIsInstalled()
     {
+        // Take note of conflicting extensions
+        $conf = $this->getEmConf();
+        $conflicts = $conf['rtehtmlarea']['constraints']['conflicts'];
+
         $languageService = $this->getLanguageService();
         $title = $languageService->sL('LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_statusreport.xlf:title');
         $conflictingExtensions = array();
-        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['conflicts'])) {
-            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['conflicts'] as $extensionKey => $version) {
+        if (is_array($conflicts)) {
+            foreach ($conflicts as $extensionKey => $version) {
                 if (ExtensionManagementUtility::isLoaded($extensionKey)) {
                     $conflictingExtensions[] = $extensionKey;
                 }
@@ -75,4 +79,14 @@ class StatusReportConflictsCheckHook implements StatusProviderInterface
     {
         return $GLOBALS['LANG'];
     }
+
+    /**
+     * @return array
+     */
+    protected function getEmConf()
+    {
+        $_EXTKEY = 'rtehtmlarea';
+        require_once ExtensionManagementUtility::extPath('rtehtmlarea') . 'ext_emconf.php';
+        return $EM_CONF;
+    }
 }
index c97f4bf..557c8eb 100644 (file)
@@ -8,10 +8,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SYS']['formEngine']['nodeResolver'][1433167475] = a
     'class' => \TYPO3\CMS\Rtehtmlarea\Form\Resolver\RichTextNodeResolver::class,
 );
 
-// Make the extension version number available to the extension scripts
-require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('rtehtmlarea') . 'ext_emconf.php';
-
-$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['version'] = $EM_CONF['rtehtmlarea']['version'];
 // Unserializing the configuration so we can use it here
 $_EXTCONF = unserialize($_EXTCONF, ['allowed_classes' => false]);
 
@@ -36,9 +32,6 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['softRefParser']['rtehtmlare
 
 // Add Status Report about Conflicting Extensions
 if (TYPO3_MODE === 'BE') {
-    // Take note of conflicting extensions
-    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['conflicts'] = $EM_CONF['rtehtmlarea']['constraints']['conflicts'];
-    // Register Status Report Hook
     $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['htmlArea RTE'][] = \TYPO3\CMS\Rtehtmlarea\Hook\StatusReportConflictsCheckHook::class;
 }