From: Alexander Ebert Date: Mon, 14 Nov 2022 15:45:40 +0000 (+0100) Subject: Move the HTTP header for legacy requests into the `AJAXProxyAction` X-Git-Tag: 6.0.0_Alpha_1~721^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8c17b5b92983eba3fda2807fb189f633deaf59e9;p=GitHub%2FWoltLab%2FWCF.git Move the HTTP header for legacy requests into the `AJAXProxyAction` --- diff --git a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php index 813ccf3e69..7858eec89e 100644 --- a/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXProxyAction.class.php @@ -3,9 +3,11 @@ namespace wcf\action; use wcf\data\IDatabaseObjectAction; +use wcf\http\middleware\TriggerBackgroundQueue; use wcf\system\exception\ImplementationException; use wcf\system\exception\ParentClassException; use wcf\system\exception\UserInputException; +use wcf\system\request\RequestHandler; use wcf\system\WCF; use wcf\system\WCFACP; use wcf\util\ArrayUtil; @@ -114,6 +116,16 @@ class AJAXProxyAction extends AJAXInvokeAction } } + if (!RequestHandler::getInstance()->isACPRequest() && WCF::getSession()->getVar('forceBackgroundQueuePerform')) { + @\header( + \sprintf( + '%s: %s', + TriggerBackgroundQueue::HEADER_NAME, + TriggerBackgroundQueue::HEADER_VALUE, + ) + ); + } + parent::sendResponse(); } } diff --git a/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php b/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php index c23720dd5b..5ba434988b 100644 --- a/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php +++ b/wcfsetup/install/files/lib/http/middleware/TriggerBackgroundQueue.class.php @@ -22,8 +22,8 @@ use wcf\system\request\RequestHandler; */ final class TriggerBackgroundQueue implements MiddlewareInterface { - private const HEADER_NAME = 'woltlab-background-queue-check'; - private const HEADER_VALUE = 'yes'; + public const HEADER_NAME = 'woltlab-background-queue-check'; + public const HEADER_VALUE = 'yes'; private readonly BackgroundQueueHandler $backgroundQueueHandler; private readonly RequestHandler $requestHandler; @@ -48,10 +48,6 @@ final class TriggerBackgroundQueue implements MiddlewareInterface } if ($response instanceof LegacyPlaceholderResponse) { - \header( - \sprintf('%s: %s', self::HEADER_NAME, self::HEADER_VALUE) - ); - return $response; }