Revert "[!!!][BUGFIX] Skip cache hash for URIs to non-cacheable actions" 88/43688/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Thu, 1 Oct 2015 09:05:58 +0000 (11:05 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 5 Oct 2015 21:13:21 +0000 (23:13 +0200)
This reverts commit 3ab6f2a08283041d52a05db3e26817c66024da88.

This change caused trouble, as it was not possible any more to explicitly enable
cHash usage. In situations where some arguments are required for a cHash, this
will lead to a broken page (404) when the cHash is skipped.

As the possible gain of not having the cHash is low but the possible impact is high
and a potential fix is breaking or at least fragile as well, this feature is reverted again.

Resolves: #67097
Reverts: #60272
Releases: master
Change-Id: Ia14947f8eb6b6125b0402ae7e046c78a1597aeae
Reviewed-on: http://review.typo3.org/43688
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Documentation/Changelog/7.2/Breaking-60272-SkipCacheHashForUrisToNonCacheableActions.rst [deleted file]
typo3/sysext/extbase/Classes/Mvc/Web/Routing/UriBuilder.php
typo3/sysext/extbase/Tests/Unit/Mvc/Web/Routing/UriBuilderTest.php

diff --git a/typo3/sysext/core/Documentation/Changelog/7.2/Breaking-60272-SkipCacheHashForUrisToNonCacheableActions.rst b/typo3/sysext/core/Documentation/Changelog/7.2/Breaking-60272-SkipCacheHashForUrisToNonCacheableActions.rst
deleted file mode 100644 (file)
index 93aaaef..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-====================================================================
-Breaking: #60272 - Skip cache hash for URIs to non-cacheable actions
-====================================================================
-
-Description
-===========
-
-The cache hash (cHash) parameter is not added to action URIs if the current
-request is not cached and the target action is not cacheable.
-
-
-Impact
-======
-
-Less cache entries are generated per page and not every action URI will have
-a cHash argument any more. It might be necessary to clear caches of extensions
-generating human readable URLs like RealURL.
-
-
-Affected installations
-======================
-
-Extbase extensions that generate links from uncached actions/pages to not
-cacheable actions.
index 700c34a..8348f64 100644 (file)
@@ -530,9 +530,6 @@ class UriBuilder {
                if ($pluginName === NULL) {
                        $pluginName = $this->request->getPluginName();
                }
-
-               $this->disableCacheHashForNonCacheableAction($controllerArguments);
-
                if ($this->environmentService->isEnvironmentInFrontendMode() && $this->configurationManager->isFeatureEnabled('skipDefaultArguments')) {
                        $controllerArguments = $this->removeDefaultControllerAndAction($controllerArguments, $extensionName, $pluginName);
                }
@@ -553,26 +550,6 @@ class UriBuilder {
        }
 
        /**
-        * Disable cache hash if the action is not cacheable
-        * and pointed to from an already uncached request
-        *
-        * @param array $controllerArguments the current controller arguments
-        * @return void
-        */
-       protected function disableCacheHashForNonCacheableAction(array $controllerArguments) {
-               if (isset($controllerArguments['action']) && $this->getUseCacheHash()) {
-                       $actionIsCacheable = $this->extensionService->isActionCacheable(
-                               NULL,
-                               NULL,
-                               $controllerArguments['controller'],
-                               $controllerArguments['action']
-                       );
-                       $isRequestCached = $this->request instanceof WebRequest && $this->request->isCached();
-                       $this->setUseCacheHash($isRequestCached || $actionIsCacheable);
-               }
-       }
-
-       /**
         * This removes controller and/or action arguments from given controllerArguments
         * if they are equal to the default controller/action of the target plugin.
         * Note: This is only active in FE mode and if feature "skipDefaultArguments" is enabled
index 06f12f7..8022583 100644 (file)
@@ -185,45 +185,12 @@ class UriBuilderTest extends UnitTestCase {
        }
 
        /**
-        * @param bool $isActionCacheable
-        * @param bool $requestIsCached
-        * @param bool $expectedUseCacheHash
         * @test
-        * @dataProvider uriForDisablesCacheHashIfPossibleDataProvider
         */
-       public function uriForDisablesCacheHashIfPossible($isActionCacheable, $requestIsCached, $expectedUseCacheHash) {
-               $this->mockExtensionService->expects($this->once())->method('isActionCacheable')->will($this->returnValue($isActionCacheable));
-               $this->mockRequest->expects($this->once())->method('isCached')->will($this->returnValue($requestIsCached));
+       public function uriForDoesNotDisableCacheHashForNonCacheableActions() {
+               $this->mockExtensionService->expects($this->any())->method('isActionCacheable')->will($this->returnValue(FALSE));
                $this->uriBuilder->uriFor('someNonCacheableAction', array(), 'SomeController', 'SomeExtension');
-               $this->assertEquals($expectedUseCacheHash, $this->uriBuilder->getUseCacheHash());
-       }
-
-       /**
-        * @return array
-        */
-       public function uriForDisablesCacheHashIfPossibleDataProvider() {
-               return array(
-                       'request cached, action cacheable' => array(
-                               TRUE,
-                               TRUE,
-                               TRUE,
-                       ),
-                       'request cached, action not cacheable' => array(
-                               TRUE,
-                               FALSE,
-                               TRUE,
-                       ),
-                       'request not cached, action cacheable' => array(
-                               FALSE,
-                               TRUE,
-                               TRUE,
-                       ),
-                       'request not cached, action not cacheable' => array(
-                               FALSE,
-                               FALSE,
-                               FALSE,
-                       ),
-               );
+               $this->assertTrue($this->uriBuilder->getUseCacheHash());
        }
 
        /**