From 11a5b897fd3ef100769694f1f05e563520dba91c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 6 Aug 2021 15:49:17 +0200 Subject: [PATCH] Use PSR-7 responses in BackgroundQueuePerformAction --- .../lib/action/BackgroundQueuePerformAction.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php b/wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php index 26b79734a5..7924fdc595 100644 --- a/wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php +++ b/wcfsetup/install/files/lib/action/BackgroundQueuePerformAction.class.php @@ -2,6 +2,7 @@ namespace wcf\action; +use Laminas\Diactoros\Response\JsonResponse; use wcf\system\background\BackgroundQueueHandler; use wcf\system\WCF; @@ -29,16 +30,17 @@ class BackgroundQueuePerformAction extends AbstractAction { parent::execute(); - \header('Content-type: application/json; charset=UTF-8'); for ($i = 0; $i < self::$jobsPerRun; $i++) { if (BackgroundQueueHandler::getInstance()->performNextJob() === false) { // there were no more jobs break; } } - echo BackgroundQueueHandler::getInstance()->getRunnableCount(); + WCF::getSession()->deleteIfNew(); - exit; + return new JsonResponse( + BackgroundQueueHandler::getInstance()->getRunnableCount() + ); } } -- 2.20.1