Improved addMissingMetadata() on POST failure
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 22 Jul 2015 20:19:12 +0000 (13:19 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 22 Jul 2015 20:19:12 +0000 (13:19 -0700)
* If the POST failed but the sha1 was computed, then use
  and cache that value rather than "false".

Change-Id: I42b53c823013ecd9b281406e3d533a21e0de7cfb

includes/filebackend/SwiftFileBackend.php

index 2ccafe4..e9df205 100644 (file)
@@ -670,10 +670,10 @@ class SwiftFileBackend extends FileBackendStore {
                $ps = Profiler::instance()->scopedProfileIn( __METHOD__ . "-{$this->name}" );
                wfDebugLog( 'SwiftBackend', __METHOD__ . ": $path was not stored with SHA-1 metadata." );
 
+               $objHdrs['x-object-meta-sha1base36'] = false;
+
                $auth = $this->getAuthentication();
                if ( !$auth ) {
-                       $objHdrs['x-object-meta-sha1base36'] = false;
-
                        return $objHdrs; // failed
                }
 
@@ -700,7 +700,6 @@ class SwiftFileBackend extends FileBackendStore {
                }
 
                wfDebugLog( 'SwiftBackend', __METHOD__ . ": unable to set SHA-1 metadata for $path" );
-               $objHdrs['x-object-meta-sha1base36'] = false;
 
                return $objHdrs; // failed
        }