Wrap background job execution in an output buffer
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 17 Jan 2017 13:45:47 +0000 (14:45 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 17 Jan 2017 13:46:14 +0000 (14:46 +0100)
wcfsetup/install/files/lib/system/background/BackgroundQueueHandler.class.php

index 686a613d32903c53d13fd6f0fbd62a6daddd8ad3..c2b62efd1d897260a17ff18ef399022069553411 100644 (file)
@@ -89,6 +89,9 @@ class BackgroundQueueHandler extends SingletonFactory {
                
                try {
                        SessionHandler::getInstance()->changeUser(new User(null), true);
+                       if (!WCF::debugModeIsEnabled()) {
+                               ob_start();
+                       }
                        $job->perform();
                }
                catch (\Throwable $e) {
@@ -124,6 +127,9 @@ class BackgroundQueueHandler extends SingletonFactory {
                        }
                }
                finally {
+                       if (!WCF::debugModeIsEnabled()) {
+                               ob_end_clean();
+                       }
                        SessionHandler::getInstance()->changeUser($user, true);
                }
        }