Merge "FileRepo: create output buffer and set ob_implicit_flush for file streaming"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 9 Aug 2017 18:15:43 +0000 (18:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 9 Aug 2017 18:15:43 +0000 (18:15 +0000)
includes/filerepo/FileRepo.php

index f89d96b..dc36e50 100644 (file)
@@ -1602,9 +1602,15 @@ class FileRepo {
                $path = $this->resolveToStoragePath( $virtualUrl );
                $params = [ 'src' => $path, 'headers' => $headers, 'options' => $optHeaders ];
 
+               // T172851: HHVM does not flush the output properly, causing OOM
+               ob_start( NULL, 1048576 );
+               ob_implicit_flush( true );
+
                $status = $this->newGood();
                $status->merge( $this->backend->streamFile( $params ) );
 
+               ob_end_flush();
+
                return $status;
        }