[FileRepo] Use resolveToStoragePath() in more places.
authorAaron <aschulz@wikimedia.org>
Tue, 17 Apr 2012 17:56:35 +0000 (10:56 -0700)
committerAaron <aschulz@wikimedia.org>
Tue, 17 Apr 2012 17:56:35 +0000 (10:56 -0700)
Change-Id: I97d4e723f8756f44873a4af2bc3b73ea1965f152

includes/filerepo/FileRepo.php

index 8fe786a..d38f5ca 100644 (file)
@@ -706,9 +706,7 @@ class FileRepo {
                        }
 
                        // Resolve source to a storage path if virtual
-                       if ( self::isVirtualUrl( $srcPath ) ) {
-                               $srcPath = $this->resolveVirtualUrl( $srcPath );
-                       }
+                       $srcPath = $this->resolveToStoragePath( $srcPath );
 
                        // Get the appropriate file operation
                        if ( FileBackend::isStoragePath( $srcPath ) ) {
@@ -767,9 +765,7 @@ class FileRepo {
                                $path = $this->getZonePath( $zone ) . "/$rel";
                        } else {
                                // Resolve source to a storage path if virtual
-                               if ( self::isVirtualUrl( $path ) ) {
-                                       $path = $this->resolveVirtualUrl( $path );
-                               }
+                               $path = $this->resolveToStoragePath( $path );
                        }
                        $operations[] = array( 'op' => 'delete', 'src' => $path );
                }
@@ -1007,9 +1003,7 @@ class FileRepo {
                foreach ( $triplets as $i => $triplet ) {
                        list( $srcPath, $dstRel, $archiveRel ) = $triplet;
                        // Resolve source to a storage path if virtual
-                       if ( $this->isVirtualUrl( $srcPath ) ) {
-                               $srcPath = $this->resolveVirtualUrl( $srcPath );
-                       }
+                       $srcPath = $this->resolveToStoragePath( $srcPath );
                        if ( !$this->validateFilename( $dstRel ) ) {
                                throw new MWException( 'Validation error in $dstRel' );
                        }
@@ -1128,9 +1122,7 @@ class FileRepo {
        public function fileExistsBatch( array $files ) {
                $result = array();
                foreach ( $files as $key => $file ) {
-                       if ( self::isVirtualUrl( $file ) ) {
-                               $file = $this->resolveVirtualUrl( $file );
-                       }
+                       $file = $this->resolveToStoragePath( $file );
                        $result[$key] = $this->backend->fileExists( array( 'src' => $file ) );
                }
                return $result;