From bf25b795eabc9f5e18828084347b6d62f71cd015 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Tue, 10 Sep 2019 10:10:44 +0100 Subject: [PATCH] filebackend: Use HTTPFileStreamer::send404Message() in caller instead Replaced usage of StreamFile::STEAM_HEADLESS (now making it unused) by HTTPFileStreamer::STREAM_HEADLESS. Also, deprecated these unused constants. Searched around and found nothing and CS also says so too; https://codesearch.wmflabs.org/search/?q=StreamFile%3A%3A(STREAM_ALLOW_OB%7CSTREAM_HEADLESS)&i=nope&files=&repos= Change-Id: Ia3fc2cf072fa2fddb910c64a547d12cb243290d5 --- includes/StreamFile.php | 2 ++ includes/libs/filebackend/SwiftFileBackend.php | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/StreamFile.php b/includes/StreamFile.php index 2ad42e5616..dfe6badd41 100644 --- a/includes/StreamFile.php +++ b/includes/StreamFile.php @@ -25,8 +25,10 @@ */ class StreamFile { // Do not send any HTTP headers unless requested by caller (e.g. body only) + /** @deprecated since 1.34 */ const STREAM_HEADLESS = HTTPFileStreamer::STREAM_HEADLESS; // Do not try to tear down any PHP output buffers + /** @deprecated since 1.34 */ const STREAM_ALLOW_OB = HTTPFileStreamer::STREAM_ALLOW_OB; /** diff --git a/includes/libs/filebackend/SwiftFileBackend.php b/includes/libs/filebackend/SwiftFileBackend.php index edea75f71a..5632d5e63c 100644 --- a/includes/libs/filebackend/SwiftFileBackend.php +++ b/includes/libs/filebackend/SwiftFileBackend.php @@ -1083,11 +1083,11 @@ class SwiftFileBackend extends FileBackendStore { protected function doStreamFile( array $params ) { $status = $this->newStatus(); - $flags = !empty( $params['headless'] ) ? StreamFile::STREAM_HEADLESS : 0; + $flags = !empty( $params['headless'] ) ? HTTPFileStreamer::STREAM_HEADLESS : 0; list( $srcCont, $srcRel ) = $this->resolveStoragePathReal( $params['src'] ); if ( $srcRel === null ) { - StreamFile::send404Message( $params['src'], $flags ); + HTTPFileStreamer::send404Message( $params['src'], $flags ); $status->fatal( 'backend-fail-invalidpath', $params['src'] ); return $status; @@ -1095,7 +1095,7 @@ class SwiftFileBackend extends FileBackendStore { $auth = $this->getAuthentication(); if ( !$auth || !is_array( $this->getContainerStat( $srcCont ) ) ) { - StreamFile::send404Message( $params['src'], $flags ); + HTTPFileStreamer::send404Message( $params['src'], $flags ); $status->fatal( 'backend-fail-stream', $params['src'] ); return $status; @@ -1104,7 +1104,7 @@ class SwiftFileBackend extends FileBackendStore { // If "headers" is set, we only want to send them if the file is there. // Do not bother checking if the file exists if headers are not set though. if ( $params['headers'] && !$this->fileExists( $params ) ) { - StreamFile::send404Message( $params['src'], $flags ); + HTTPFileStreamer::send404Message( $params['src'], $flags ); $status->fatal( 'backend-fail-stream', $params['src'] ); return $status; -- 2.20.1