[TASK] Remove persistent cache in GeneralUtility::xml2array 63/47663/2
authorOliver Hader <oliver@typo3.org>
Thu, 14 Apr 2016 12:22:26 +0000 (14:22 +0200)
committerMorton Jonuschat <m.jonuschat@mojocode.de>
Thu, 14 Apr 2016 14:09:39 +0000 (16:09 +0200)
The method GeneralUtility::xml2array uses a runtime cache and in addition
a persistent database cache. The database cache is triggered using the
"cache_hash" method in PageRepository, which is a frontend only component.
Since this approach is binding the common layer with the frontend layer,
this dependency is removed.

Resolves: #75609
Releases: master
Change-Id: I43bd92df6570502abbb5714b217f3ff0e32a588c
Reviewed-on: https://review.typo3.org/47663
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaSelectItemsTest.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php

index 0bc4d41..4fdc525 100644 (file)
@@ -576,11 +576,6 @@ class TcaSelectItemsTest extends UnitTestCase
         $languageService->loadSingleTableDescription(Argument::cetera())->willReturn(null);
         $languageService->sL(Argument::cetera())->willReturnArgument(0);
 
-        // Needed to suppress a cache in xml2array
-        /** @var DatabaseConnection|ObjectProphecy $database */
-        $database = $this->prophesize(DatabaseConnection::class);
-        $GLOBALS['TYPO3_DB'] = $database->reveal();
-
         $expectedItems = [
             0 => [
                 0 => 'fooTableTitle aFlexFieldTitle dummy',
index 473dac6..6d4883a 100755 (executable)
@@ -1775,13 +1775,7 @@ class GeneralUtility
         if (!empty($firstLevelCache[$identifier])) {
             $array = $firstLevelCache[$identifier];
         } else {
-            // Look up in second level cache
-            // @todo: Is this cache really required? It basically substitutes a little cpu work with a db query?
-            $array = PageRepository::getHash($identifier, 0);
-            if (!is_array($array)) {
-                $array = self::xml2arrayProcess($string, $NSprefix, $reportDocTag);
-                PageRepository::storeHash($identifier, $array, 'ident_xml2array');
-            }
+            $array = self::xml2arrayProcess($string, $NSprefix, $reportDocTag);
             // Store content in first level cache
             $firstLevelCache[$identifier] = $array;
         }