From: Aaron Date: Thu, 30 Aug 2012 17:10:50 +0000 (-0700) Subject: [FileBackend] Reduce backend sync errors a bit by aborting operations more. X-Git-Tag: 1.31.0-rc.0~22529^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=0da6eaea051953a03ad214475b14aba711cd0fdc;p=lhc%2Fweb%2Fwiklou.git [FileBackend] Reduce backend sync errors a bit by aborting operations more. Change-Id: Iedb8d7e1f95c971dbb9f9baed67de047753ab40d --- diff --git a/includes/filebackend/FileBackendMultiWrite.php b/includes/filebackend/FileBackendMultiWrite.php index 59392f6162..9efa0dbbcf 100644 --- a/includes/filebackend/FileBackendMultiWrite.php +++ b/includes/filebackend/FileBackendMultiWrite.php @@ -160,11 +160,14 @@ class FileBackendMultiWrite extends FileBackend { // Actually attempt the operation batch on the master backend... $masterStatus = $mbe->doOperations( $realOps, $opts ); $status->merge( $masterStatus ); - // Propagate the operations to the clone backends... - foreach ( $this->backends as $index => $backend ) { - if ( $index !== $this->masterIndex ) { // not done already - $realOps = $this->substOpBatchPaths( $ops, $backend ); - $status->merge( $backend->doOperations( $realOps, $opts ) ); + // Propagate the operations to the clone backends if there were no fatal errors. + // If $ops only had one operation, this might avoid backend inconsistencies. + if ( !count( $masterStatus->getErrorsArray() ) ) { + foreach ( $this->backends as $index => $backend ) { + if ( $index !== $this->masterIndex ) { // not done already + $realOps = $this->substOpBatchPaths( $ops, $backend ); + $status->merge( $backend->doOperations( $realOps, $opts ) ); + } } } // Make 'success', 'successCount', and 'failCount' fields reflect