From 8d4b97f364c1d2e97d98d2bb658c51d1e81fc068 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Mon, 13 Mar 2017 14:26:56 -0700 Subject: [PATCH] Use executeOpHandlesInternal() in SwiftFileBackend Instead calling doExecuteOpHandlesInternal() directly, use the wrapper parent class method instead so that closeResources() is called on all of the handles. Change-Id: Iab0d4f7c08d155639a44f48147b78283059a6d24 --- includes/libs/filebackend/FileBackendStore.php | 9 ++++----- includes/libs/filebackend/SwiftFileBackend.php | 12 ++++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/includes/libs/filebackend/FileBackendStore.php b/includes/libs/filebackend/FileBackendStore.php index 7cb26c6c65..039bd42508 100644 --- a/includes/libs/filebackend/FileBackendStore.php +++ b/includes/libs/filebackend/FileBackendStore.php @@ -1200,21 +1200,20 @@ abstract class FileBackendStore extends FileBackend { * to the order in which the handles where given. * * @param FileBackendStoreOpHandle[] $fileOpHandles - * - * @throws FileBackendError * @return StatusValue[] Map of StatusValue objects + * @throws FileBackendError */ final public function executeOpHandlesInternal( array $fileOpHandles ) { $ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" ); foreach ( $fileOpHandles as $fileOpHandle ) { if ( !( $fileOpHandle instanceof FileBackendStoreOpHandle ) ) { - throw new InvalidArgumentException( "Got a non-FileBackendStoreOpHandle object." ); + throw new InvalidArgumentException( "Expected FileBackendStoreOpHandle object." ); } elseif ( $fileOpHandle->backend->getName() !== $this->getName() ) { - throw new InvalidArgumentException( - "Got a FileBackendStoreOpHandle for the wrong backend." ); + throw new InvalidArgumentException( "Expected handle for this file backend." ); } } + $res = $this->doExecuteOpHandlesInternal( $fileOpHandles ); foreach ( $fileOpHandles as $fileOpHandle ) { $fileOpHandle->closeResources(); diff --git a/includes/libs/filebackend/SwiftFileBackend.php b/includes/libs/filebackend/SwiftFileBackend.php index 631f6fd6fa..ae0ad6fb84 100644 --- a/includes/libs/filebackend/SwiftFileBackend.php +++ b/includes/libs/filebackend/SwiftFileBackend.php @@ -287,7 +287,7 @@ class SwiftFileBackend extends FileBackendStore { if ( !empty( $params['async'] ) ) { // deferred $status->value = $opHandle; } else { // actually write the object in Swift - $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) ); + $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) ); } return $status; @@ -353,7 +353,7 @@ class SwiftFileBackend extends FileBackendStore { if ( !empty( $params['async'] ) ) { // deferred $status->value = $opHandle; } else { // actually write the object in Swift - $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) ); + $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) ); } return $status; @@ -401,7 +401,7 @@ class SwiftFileBackend extends FileBackendStore { if ( !empty( $params['async'] ) ) { // deferred $status->value = $opHandle; } else { // actually write the object in Swift - $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) ); + $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) ); } return $status; @@ -460,7 +460,7 @@ class SwiftFileBackend extends FileBackendStore { if ( !empty( $params['async'] ) ) { // deferred $status->value = $opHandle; } else { // actually move the object in Swift - $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) ); + $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) ); } return $status; @@ -500,7 +500,7 @@ class SwiftFileBackend extends FileBackendStore { if ( !empty( $params['async'] ) ) { // deferred $status->value = $opHandle; } else { // actually delete the object in Swift - $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) ); + $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) ); } return $status; @@ -556,7 +556,7 @@ class SwiftFileBackend extends FileBackendStore { if ( !empty( $params['async'] ) ) { // deferred $status->value = $opHandle; } else { // actually change the object in Swift - $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) ); + $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) ); } return $status; -- 2.20.1