From: Tim Düsterhus Date: Fri, 6 Aug 2021 13:49:17 +0000 (+0200) Subject: Use PSR-7 responses in BackgroundQueuePerformAction X-Git-Tag: 5.5.0_Alpha_1~493^2^2~12 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=11a5b897fd3ef100769694f1f05e563520dba91c;p=GitHub%2FWoltLab%2FWCF.git Use PSR-7 responses in BackgroundQueuePerformAction --- 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() + ); } }