Merge "[FileBackend] Improved getLocalCopy() performance for Swift."
authorDemon <chadh@wikimedia.org>
Thu, 30 Aug 2012 19:26:03 +0000 (19:26 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 30 Aug 2012 19:26:03 +0000 (19:26 +0000)
includes/filebackend/SwiftFileBackend.php

index 6f078e8..9081e82 100644 (file)
@@ -989,11 +989,8 @@ class SwiftFileBackend extends FileBackendStore {
                        return null;
                }
 
-               # Check the recursion guard to avoid loops when filling metadata
-               if ( empty( $params['nostat'] ) && !$this->fileExists( $params ) ) {
-                       return null;
-               }
-
+               // Blindly create a tmp file and stream to it, catching any exception if the file does
+               // not exist. Also, doing a stat here will cause infinite loops when filling metadata.
                $tmpFile = null;
                try {
                        $sContObj = $this->getContainer( $srcCont );
@@ -1013,6 +1010,8 @@ class SwiftFileBackend extends FileBackendStore {
                        }
                } catch ( NoSuchContainerException $e ) {
                        $tmpFile = null;
+               } catch ( NoSuchObjectException $e ) {
+                       $tmpFile = null;
                } catch ( CloudFilesException $e ) { // some other exception?
                        $tmpFile = null;
                        $this->handleException( $e, null, __METHOD__, $params );