filerepo: avoid dynamic calls to FileRepo::isVirtualUrl
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 18 Jan 2019 21:03:45 +0000 (13:03 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 18 Jan 2019 21:03:45 +0000 (13:03 -0800)
Change-Id: Ie851ec33ba5d7965393e41595d0b4b9df070bd27

includes/filerepo/file/LocalFile.php
includes/upload/UploadBase.php
includes/upload/UploadStash.php

index f883dea..878e82d 100644 (file)
@@ -1320,7 +1320,7 @@ class LocalFile extends File {
 
                $srcPath = ( $src instanceof FSFile ) ? $src->getPath() : $src;
                if ( !$props ) {
-                       if ( $this->repo->isVirtualUrl( $srcPath )
+                       if ( FileRepo::isVirtualUrl( $srcPath )
                                || FileBackend::isStoragePath( $srcPath )
                        ) {
                                $props = $this->repo->getFileProps( $srcPath );
@@ -1863,7 +1863,7 @@ class LocalFile extends File {
                $archiveRel = $this->getArchiveRel( $archiveName );
 
                if ( $repo->hasSha1Storage() ) {
-                       $sha1 = $repo->isVirtualUrl( $srcPath )
+                       $sha1 = FileRepo::isVirtualUrl( $srcPath )
                                ? $repo->getFileSha1( $srcPath )
                                : FSFile::getSha1Base36FromPath( $srcPath );
                        /** @var FileBackendDBRepoWrapper $wrapperBackend */
index a579b69..d9e8e99 100644 (file)
@@ -296,7 +296,7 @@ abstract class UploadBase {
         */
        public function getRealPath( $srcPath ) {
                $repo = RepoGroup::singleton()->getLocalRepo();
-               if ( $repo->isVirtualUrl( $srcPath ) ) {
+               if ( FileRepo::isVirtualUrl( $srcPath ) ) {
                        /** @todo Just make uploads work with storage paths UploadFromStash
                         *  loads files via virtual URLs.
                         */
index 8ddbd04..babbe3a 100644 (file)
@@ -599,7 +599,7 @@ class UploadStashFile extends UnregisteredLocalFile {
                $this->fileKey = $key;
 
                // resolve mwrepo:// urls
-               if ( $repo->isVirtualUrl( $path ) ) {
+               if ( FileRepo::isVirtualUrl( $path ) ) {
                        $path = $repo->resolveVirtualUrl( $path );
                } else {
                        // check if path appears to be sane, no parent traversals,