X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Ffilebackend%2FFileBackendMultiWrite.php;h=27ad870ae59927b313af515eab7d642a757e390e;hb=724a574a24ea5d75d33d1977f6754b323ad01cbe;hp=655a71048c00dd227c782f5d6a810dfb0ba8200b;hpb=55aab97bb4b507911e24995ae870b78f86c17557;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/filebackend/FileBackendMultiWrite.php b/includes/libs/filebackend/FileBackendMultiWrite.php index 655a71048c..27ad870ae5 100644 --- a/includes/libs/filebackend/FileBackendMultiWrite.php +++ b/includes/libs/filebackend/FileBackendMultiWrite.php @@ -87,11 +87,8 @@ class FileBackendMultiWrite extends FileBackend { * This will apply such updates post-send for web requests. Note that * any checks from "syncChecks" are still synchronous. * - * Bogus warning - * @suppress PhanAccessMethodProtected - * * @param array $config - * @throws FileBackendError + * @throws LogicException */ public function __construct( array $config ) { parent::__construct( $config ); @@ -181,9 +178,8 @@ class FileBackendMultiWrite extends FileBackend { $masterStatus = $mbe->doOperations( $realOps, $opts ); $status->merge( $masterStatus ); // Propagate the operations to the clone backends if there were no unexpected errors - // and if there were either no expected errors or if the 'force' option was used. - // However, if nothing succeeded at all, then don't replicate any of the operations. - // If $ops only had one operation, this might avoid backend sync inconsistencies. + // and everything didn't fail due to predicted errors. If $ops only had one operation, + // this might avoid backend sync inconsistencies. if ( $masterStatus->isOK() && $masterStatus->successCount > 0 ) { foreach ( $this->backends as $index => $backend ) { if ( $index === $this->masterIndex ) { @@ -260,11 +256,11 @@ class FileBackendMultiWrite extends FileBackend { $status->fatal( 'backend-fail-synced', $path ); continue; } - if ( $this->syncChecks & self::CHECK_SIZE ) { - if ( $cStat['size'] != $mStat['size'] ) { // wrong size - $status->fatal( 'backend-fail-synced', $path ); - continue; - } + if ( ( $this->syncChecks & self::CHECK_SIZE ) + && $cStat['size'] != $mStat['size'] + ) { // wrong size + $status->fatal( 'backend-fail-synced', $path ); + continue; } if ( $this->syncChecks & self::CHECK_TIME ) { $mTs = wfTimestamp( TS_UNIX, $mStat['mtime'] ); @@ -274,16 +270,15 @@ class FileBackendMultiWrite extends FileBackend { continue; } } - if ( $this->syncChecks & self::CHECK_SHA1 ) { - if ( $cBackend->getFileSha1Base36( $cParams ) !== $mSha1 ) { // wrong SHA1 - $status->fatal( 'backend-fail-synced', $path ); - continue; - } - } - } else { // file is not in master - if ( $cStat ) { // file should not exist + if ( + ( $this->syncChecks & self::CHECK_SHA1 ) && + $cBackend->getFileSha1Base36( $cParams ) !== $mSha1 + ) { // wrong SHA1 $status->fatal( 'backend-fail-synced', $path ); + continue; } + } elseif ( $cStat ) { // file is not in master; file should not exist + $status->fatal( 'backend-fail-synced', $path ); } } }