Merge "Make importTextFiles.php work with wildcards on the Windows shell"
[lhc/web/wiklou.git] / includes / filerepo / FileRepo.php
index 9ad2428..4ab913d 100644 (file)
@@ -533,11 +533,10 @@ class FileRepo {
        public function findFileFromKey( $sha1, $options = [] ) {
                $time = isset( $options['time'] ) ? $options['time'] : false;
                # First try to find a matching current version of a file...
-               if ( $this->fileFactoryKey ) {
-                       $img = call_user_func( $this->fileFactoryKey, $sha1, $this, $time );
-               } else {
+               if ( !$this->fileFactoryKey ) {
                        return false; // find-by-sha1 not supported
                }
+               $img = call_user_func( $this->fileFactoryKey, $sha1, $this, $time );
                if ( $img && $img->exists() ) {
                        return $img;
                }
@@ -1586,12 +1585,13 @@ class FileRepo {
         *
         * @param string $virtualUrl
         * @param array $headers Additional HTTP headers to send on success
+        * @param array $optHeaders HTTP request headers (if-modified-since, range, ...)
         * @return Status
         * @since 1.27
         */
-       public function streamFileWithStatus( $virtualUrl, $headers = [] ) {
+       public function streamFileWithStatus( $virtualUrl, $headers = [], $optHeaders = [] ) {
                $path = $this->resolveToStoragePath( $virtualUrl );
-               $params = [ 'src' => $path, 'headers' => $headers ];
+               $params = [ 'src' => $path, 'headers' => $headers, 'options' => $optHeaders ];
 
                return $this->backend->streamFile( $params );
        }