filebackend: Use HTTPFileStreamer::send404Message() in caller instead
authorDerick Alangi <alangiderick@gmail.com>
Tue, 10 Sep 2019 09:10:44 +0000 (10:10 +0100)
committerDerick Alangi <alangiderick@gmail.com>
Thu, 12 Sep 2019 13:09:39 +0000 (14:09 +0100)
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
includes/libs/filebackend/SwiftFileBackend.php

index 2ad42e5..dfe6bad 100644 (file)
  */
 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;
 
        /**
index edea75f..5632d5e 100644 (file)
@@ -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;