filebackend: update code comments and break some long lines
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 23 Aug 2019 15:45:54 +0000 (08:45 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 24 Aug 2019 10:32:12 +0000 (03:32 -0700)
Change-Id: I072e15c7c51490888284561260958e405fb061ca

includes/libs/filebackend/FileBackend.php
includes/libs/filebackend/FileBackendMultiWrite.php
includes/libs/filebackend/FileOpBatch.php

index b187fe5..4cacb7a 100644 (file)
@@ -420,7 +420,7 @@ abstract class FileBackend implements LoggerAwareInterface {
         *
         * The StatusValue will be "OK" unless:
         *   - a) unexpected operation errors occurred (network partitions, disk full...)
         *
         * The StatusValue will be "OK" unless:
         *   - a) unexpected operation errors occurred (network partitions, disk full...)
-        *   - b) significant operation errors occurred and 'force' was not set
+        *   - b) predicted operation errors occurred and 'force' was not set
         *
         * @param array $ops List of operations to execute in order
         * @param array $opts Batch operation options
         *
         * @param array $ops List of operations to execute in order
         * @param array $opts Batch operation options
index f92d5fa..27ad870 100644 (file)
@@ -88,7 +88,7 @@ class FileBackendMultiWrite extends FileBackend {
         *                      any checks from "syncChecks" are still synchronous.
         *
         * @param array $config
         *                      any checks from "syncChecks" are still synchronous.
         *
         * @param array $config
-        * @throws FileBackendError
+        * @throws LogicException
         */
        public function __construct( array $config ) {
                parent::__construct( $config );
         */
        public function __construct( array $config ) {
                parent::__construct( $config );
@@ -178,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
                $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 ) {
                if ( $masterStatus->isOK() && $masterStatus->successCount > 0 ) {
                        foreach ( $this->backends as $index => $backend ) {
                                if ( $index === $this->masterIndex ) {
@@ -271,7 +270,10 @@ class FileBackendMultiWrite extends FileBackend {
                                                        continue;
                                                }
                                        }
                                                        continue;
                                                }
                                        }
-                                       if ( ( $this->syncChecks & self::CHECK_SHA1 ) && $cBackend->getFileSha1Base36( $cParams ) !== $mSha1 ) { // wrong SHA1
+                                       if (
+                                               ( $this->syncChecks & self::CHECK_SHA1 ) &&
+                                               $cBackend->getFileSha1Base36( $cParams ) !== $mSha1
+                                       ) { // wrong SHA1
                                                $status->fatal( 'backend-fail-synced', $path );
                                                continue;
                                        }
                                                $status->fatal( 'backend-fail-synced', $path );
                                                continue;
                                        }
index 540961e..bbcda08 100644 (file)
@@ -46,7 +46,7 @@ class FileOpBatch {
         *
         * The resulting StatusValue will be "OK" unless:
         *   - a) unexpected operation errors occurred (network partitions, disk full...)
         *
         * The resulting StatusValue will be "OK" unless:
         *   - a) unexpected operation errors occurred (network partitions, disk full...)
-        *   - b) significant operation errors occurred and 'force' was not set
+        *   - b) predicted operation errors occurred and 'force' was not set
         *
         * @param FileOp[] $performOps List of FileOp operations
         * @param array $opts Batch operation options
         *
         * @param FileOp[] $performOps List of FileOp operations
         * @param array $opts Batch operation options