https://www.mediawiki.org/wiki/Special:Code/MediaWiki/110042

Revision: 110042
Author:   mglaser
Date:     2012-01-26 01:02:18 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
* follow up r110039
* killed doFileExists since it is not being called (thx to Aaron)
* only use blobExists where necessary
* all FileBackendTests pass

Modified Paths:
--------------
    
trunk/extensions/WindowsAzureStorage/includes/filerepo/backend/WindowsAzureFileBackend.php

Modified: 
trunk/extensions/WindowsAzureStorage/includes/filerepo/backend/WindowsAzureFileBackend.php
===================================================================
--- 
trunk/extensions/WindowsAzureStorage/includes/filerepo/backend/WindowsAzureFileBackend.php
  2012-01-26 00:54:16 UTC (rev 110041)
+++ 
trunk/extensions/WindowsAzureStorage/includes/filerepo/backend/WindowsAzureFileBackend.php
  2012-01-26 01:02:18 UTC (rev 110042)
@@ -74,11 +74,12 @@
                        return $status;
                }
 
-               // Check if the destination object already exists
-               $blobExists = $this->storageClient->blobExists( $dstCont, 
$dstRel );
-               if ( $blobExists && empty( $params['overwrite'] ) ) { //Blob 
exists _and_ should not be overridden
-                       $status->fatal( 'backend-fail-alreadyexists', 
$params['dst'] );
-                       return $status;
+               if ( empty( $params['overwrite'] ) ) { //Blob should not be 
overridden
+                       // Check if the destination object already exists
+                       if ( $this->storageClient->blobExists( $dstCont, 
$dstRel ) ) {
+                               $status->fatal( 'backend-fail-alreadyexists', 
$params['dst'] );
+                               return $status;
+                       }
                }
                
                try {
@@ -106,10 +107,11 @@
                        return $status;
                }
                
-               $blobExists = $this->storageClient->blobExists( $dstContainer, 
$dstDir );
-               if ( $blobExists && empty( $params['overwrite'] ) ) { //Blob 
exists _and_ should not be overridden
-                       $status->fatal( 'backend-fail-alreadyexists', 
$params['dst'] );
-                       return $status;
+               if ( empty( $params['overwrite'] ) ) { //Blob should not be 
overridden
+                       if ( $this->storageClient->blobExists( $dstContainer, 
$dstDir ) ) {
+                               $status->fatal( 'backend-fail-alreadyexists', 
$params['dst'] );
+                               return $status;
+                       }
                }
 
                try {
@@ -165,11 +167,12 @@
                        return $status;
                }
 
-               // Check if the destination object already exists
-               $blobExists = $this->storageClient->blobExists( $dstCont, 
$dstRel );
-               if ( $blobExists && empty( $params['overwrite'] ) ) { //Blob 
exists _and_ should not be overridden
-                       $status->fatal( 'backend-fail-alreadyexists', 
$params['dst'] );
-                       return $status;
+               if ( empty( $params['overwrite'] ) ) { //Blob should not be 
overridden
+                       // Check if the destination object already exists
+                       if ( $this->storageClient->blobExists( $dstCont, 
$dstRel ) ) {
+                               $status->fatal( 'backend-fail-alreadyexists', 
$params['dst'] );
+                               return $status;
+                       }
                }
 
                // Actually create the object
@@ -241,19 +244,6 @@
        }
 
        /**
-        * @see FileBackend::fileExists()
-        */
-       function doFileExists( array $params ) {
-               list( $srcCont, $srcRel ) = $this->resolveStoragePath( 
$params['src'] );
-               if ( $srcRel === null ) {
-                       return false; // invalid storage path
-               }
-
-               $exists = $this->storageClient->blobExists( $srcCont, $srcRel );
-               return $exists;
-       }
-
-       /**
         * @see FileBackend::getFileList()
         */
        function getFileListInternal( $container, $dir, array $params ) {


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to