Use PSR-7 responses in CacheClearAction
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 6 Aug 2021 13:28:51 +0000 (15:28 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 11 Aug 2021 14:29:52 +0000 (16:29 +0200)
wcfsetup/install/files/lib/acp/action/CacheClearAction.class.php

index f0ede5b66535fcdd74c4ebe199661b9a7912fed1..038f9c3ac0315b052098c3f0022708724e6671d3 100644 (file)
@@ -2,13 +2,15 @@
 
 namespace wcf\acp\action;
 
+use Laminas\Diactoros\Response\EmptyResponse;
+use Laminas\Diactoros\Response\RedirectResponse;
+use wcf\acp\page\CacheListPage;
 use wcf\action\AbstractAction;
 use wcf\data\package\update\server\PackageUpdateServer;
 use wcf\system\cache\CacheHandler;
 use wcf\system\language\LanguageFactory;
 use wcf\system\request\LinkHandler;
 use wcf\system\style\StyleHandler;
-use wcf\util\HeaderUtil;
 
 /**
  * Clears the cache.
@@ -46,10 +48,12 @@ class CacheClearAction extends AbstractAction
 
         $this->executed();
 
-        if (!isset($_POST['noRedirect'])) {
-            HeaderUtil::redirect(LinkHandler::getInstance()->getLink('CacheList'));
+        if (isset($_POST['noRedirect'])) {
+            return new EmptyResponse();
+        } else {
+            return new RedirectResponse(
+                LinkHandler::getInstance()->getControllerLink(CacheListPage::class)
+            );
         }
-
-        exit;
     }
 }