Project

General

Profile

Actions

Bug #88939

closed

Custom CacheAction cannot send success state and custom flash messages

Added by Guido Schmechel over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend JavaScript
Target version:
-
Start date:
2019-08-08
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Content:
Add a cacheAction via $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['additionalBackendItems']['cacheActions']. Everything is fine and the cache icon is displayed in the topbar. Sending a JsonResponse via interface:

    /**
     * @param ServerRequestInterface $request
     * @return ResponseInterface
     */
    public function flush(ServerRequestInterface $request): ResponseInterface
    {
        return new JsonResponse(['success' => true]);
    }

We get a red FlashMessage with the hardcoded "An error occurred while clearing the cache. It is likely not all caches were cleared as expected." text.

The message is thrown from https://github.com/TYPO3/TYPO3.CMS/blob/master/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Toolbar/ClearCacheMenu.ts#L72 because we have a response. It does not matter what is inside, as you can see.

Solution:
We need a proper solution for this typescript case. Luckily we have a similar solution here: https://github.com/TYPO3/TYPO3.CMS/blob/master/Build/Sources/TypeScript/recordlist/Resources/Public/TypeScript/ClearCache.ts#L67


Files

ext_tables.php (796 Bytes) ext_tables.php Guido Schmechel, 2019-09-25 17:15
FlushFoobarCache.php (2.53 KB) FlushFoobarCache.php Guido Schmechel, 2019-09-25 17:18
AjaxRoutes.php (192 Bytes) AjaxRoutes.php Guido Schmechel, 2019-09-25 17:18

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #89447: The notification for an error while clearing the cache is not translatableClosed2019-10-18

Actions
Actions #1

Updated by Gerrit Code Review over 4 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Actions #2

Updated by Gerrit Code Review over 4 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Actions #3

Updated by Gerrit Code Review over 4 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Actions #4

Updated by Gerrit Code Review over 4 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Updated by Guido Schmechel over 4 years ago

Steps to reproduce (in a living extension):

- Change ext_tables.php
- Add Class (Classes/Hooks/Backend/FlushFoobarCache.php)
- Add Routes (Configuration/Backend/AjaxRoutes.php)
- Flush TYPO3 System Cache
- Reload Backend

Actions #6

Updated by Gerrit Code Review over 4 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Actions #7

Updated by Gerrit Code Review over 4 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/61481

Actions #8

Updated by Guido Schmechel over 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #9

Updated by Gerrit Code Review over 4 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/62001

Actions #10

Updated by Oliver Bartsch over 4 years ago

  • Related to Bug #89447: The notification for an error while clearing the cache is not translatable added
Actions #11

Updated by Guido Schmechel over 4 years ago

  • Status changed from Under Review to Resolved
Actions #12

Updated by Benni Mack over 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF