Make sure Swift store operations close the source file handle
[lhc/web/wiklou.git] / includes / libs / filebackend / SwiftFileBackend.php
index 08cb388..631f6fd 100644 (file)
@@ -348,6 +348,8 @@ class SwiftFileBackend extends FileBackendStore {
                };
 
                $opHandle = new SwiftFileOpHandle( $this, $handler, $reqs );
+               $opHandle->resourcesToClose[] = $handle;
+
                if ( !empty( $params['async'] ) ) { // deferred
                        $status->value = $opHandle;
                } else { // actually write the object in Swift
@@ -1089,7 +1091,7 @@ class SwiftFileBackend extends FileBackendStore {
                        // good
                } elseif ( $rcode === 404 ) {
                        $status->fatal( 'backend-fail-stream', $params['src'] );
-                       // Per bug 41113, nasty things can happen if bad cache entries get
+                       // Per T43113, nasty things can happen if bad cache entries get
                        // stuck in cache. It's also possible that this error can come up
                        // with simple race conditions. Clear out the stat cache to be safe.
                        $this->clearCache( [ $params['src'] ] );
@@ -1701,7 +1703,7 @@ class SwiftFileBackend extends FileBackendStore {
         * @param array $creds From getAuthentication()
         * @param string $container
         * @param string $object
-        * @return array
+        * @return string
         */
        protected function storageUrl( array $creds, $container = null, $object = null ) {
                $parts = [ $creds['storage_url'] ];