Fixed streaming for thumbs that are already in storage.
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 23 Aug 2012 04:13:40 +0000 (21:13 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 23 Aug 2012 04:13:40 +0000 (21:13 -0700)
Change-Id: Iafbd5c435a5d63738a43f1ac4e52e6c4148d6784

includes/media/MediaTransformOutput.php

index 80766bb..cee5bbf 100644 (file)
@@ -157,7 +157,14 @@ abstract class MediaTransformOutput {
         * @return Bool success
         */
        public function streamFile( $headers = array() ) {
-               return $this->path && StreamFile::stream( $this->getLocalCopyPath(), $headers );
+               if ( !$this->path ) {
+                       return false;
+               } elseif ( FileBackend::isStoragePath( $this->path ) ) {
+                       $be = $this->file->getRepo()->getBackend();
+                       return $be->streamFile( array( 'src' => $this->path, 'headers' => $headers ) )->isOK();
+               } else { // FS-file
+                       return StreamFile::stream( $this->getLocalCopyPath(), $headers );
+               }
        }
 
        /**