[FileBackend] Suppress missing container errors with "ignoreMissingSource".
authorAaron Schulz <aschulz@wikimedia.org>
Tue, 12 Mar 2013 07:50:16 +0000 (00:50 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 12 Mar 2013 07:50:16 +0000 (00:50 -0700)
Change-Id: I2b9f4764c4938dcee61f17c31ed4d4b84fbfbcb2

includes/filebackend/SwiftFileBackend.php

index 6357b86..0f3d97a 100644 (file)
@@ -411,7 +411,9 @@ class SwiftFileBackend extends FileBackendStore {
                        $sContObj = $this->getContainer( $srcCont );
                        $dContObj = $this->getContainer( $dstCont );
                } catch ( NoSuchContainerException $e ) {
-                       $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
+                       if ( empty( $params['ignoreMissingSource'] ) || isset( $sContObj ) ) {
+                               $status->fatal( 'backend-fail-copy', $params['src'], $params['dst'] );
+                       }
                        return $status;
                } catch ( CloudFilesException $e ) { // some other exception?
                        $this->handleException( $e, $status, __METHOD__, $params );
@@ -481,7 +483,9 @@ class SwiftFileBackend extends FileBackendStore {
                        $sContObj = $this->getContainer( $srcCont );
                        $dContObj = $this->getContainer( $dstCont );
                } catch ( NoSuchContainerException $e ) {
-                       $status->fatal( 'backend-fail-move', $params['src'], $params['dst'] );
+                       if ( empty( $params['ignoreMissingSource'] ) || isset( $sContObj ) ) {
+                               $status->fatal( 'backend-fail-move', $params['src'], $params['dst'] );
+                       }
                        return $status;
                } catch ( CloudFilesException $e ) { // some other exception?
                        $this->handleException( $e, $status, __METHOD__, $params );
@@ -557,7 +561,9 @@ class SwiftFileBackend extends FileBackendStore {
                } catch ( CDNNotEnabledException $e ) {
                        // CDN not enabled; nothing to see here
                } catch ( NoSuchContainerException $e ) {
-                       $status->fatal( 'backend-fail-delete', $params['src'] );
+                       if ( empty( $params['ignoreMissingSource'] ) ) {
+                               $status->fatal( 'backend-fail-delete', $params['src'] );
+                       }
                } catch ( NoSuchObjectException $e ) {
                        if ( empty( $params['ignoreMissingSource'] ) ) {
                                $status->fatal( 'backend-fail-delete', $params['src'] );