From: Aaron Schulz Date: Wed, 21 Nov 2012 02:16:15 +0000 (-0800) Subject: Fixed metadata-loss bug from b80bd6159bdf946c1d4fa1e143fea221937d848a. X-Git-Tag: 1.31.0-rc.0~21560 X-Git-Url: http://git.cyclocoop.org//%27http:/jquery.khurshid.com/ifixpng.php/%27?a=commitdiff_plain;h=611ae607a0da884358a2704ed8bb1abdf92c0154;p=lhc%2Fweb%2Fwiklou.git Fixed metadata-loss bug from b80bd6159bdf946c1d4fa1e143fea221937d848a. * Contrary to Swift docs, doing a POST seems to kill all the old metadata headers. I noticed this in testing due to addMissingMetadata() notices. Change-Id: I988d7a8d38569823c9d66605b02705ee15a8bbe7 --- diff --git a/includes/filebackend/SwiftFileBackend.php b/includes/filebackend/SwiftFileBackend.php index 6a27e9bff4..5a9b062d9a 100644 --- a/includes/filebackend/SwiftFileBackend.php +++ b/includes/filebackend/SwiftFileBackend.php @@ -583,9 +583,11 @@ class SwiftFileBackend extends FileBackendStore { try { $sContObj = $this->getContainer( $srcCont ); - $srcObj = new CF_Object( $sContObj, $srcRel, false, false ); // skip HEAD - // Merge in the new metadata and header values... - $srcObj->headers = $hdrs; + // Get the latest version of the current metadata + $srcObj = $sContObj->get_object( $srcRel, + $this->headersFromParams( array( 'latest' => true ) ) ); + // Merge in the metadata updates... + $srcObj->headers = $hdrs + $srcObj->headers; $srcObj->sync_metadata(); // save to Swift $this->purgeCDNCache( array( $srcObj ) ); } catch ( CDNNotEnabledException $e ) { @@ -816,6 +818,7 @@ class SwiftFileBackend extends FileBackendStore { } } } + trigger_error( "Unable to set SHA-1 metadata for $path", E_USER_WARNING ); $obj->setMetadataValues( array( 'Sha1base36' => false ) ); wfProfileOut( __METHOD__ ); return false; // failed