X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Flockmanager%2FQuorumLockManager.php;h=950b283670bf44d5b96d503fff5a81ddcafa781b;hb=6cfb2e3d7a2b96d5041312fcec88248bb46573d7;hp=1d2e21aa0d70a3c99be8f71f8f8720426ce048cc;hpb=d4b06eb2082dda7ef493e42916d4650ea773ae40;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/lockmanager/QuorumLockManager.php b/includes/libs/lockmanager/QuorumLockManager.php index 1d2e21aa0d..950b283670 100644 --- a/includes/libs/lockmanager/QuorumLockManager.php +++ b/includes/libs/lockmanager/QuorumLockManager.php @@ -35,15 +35,7 @@ abstract class QuorumLockManager extends LockManager { /** @var array Map of degraded buckets */ protected $degradedBuckets = []; // (bucket index => UNIX timestamp) - final protected function doLock( array $paths, $type ) { - return $this->doLockByType( [ $type => $paths ] ); - } - - final protected function doUnlock( array $paths, $type ) { - return $this->doUnlockByType( [ $type => $paths ] ); - } - - protected function doLockByType( array $pathsByType ) { + final protected function doLockByType( array $pathsByType ) { $status = StatusValue::newGood(); $pathsToLock = []; // (bucket => type => paths) @@ -98,7 +90,7 @@ abstract class QuorumLockManager extends LockManager { $bucket = $this->getBucketFromPath( $path ); $pathsToUnlock[$bucket][$type][] = $path; } - if ( !count( $this->locksHeld[$path] ) ) { + if ( $this->locksHeld[$path] === [] ) { unset( $this->locksHeld[$path] ); // no SH or EX locks left for key } } @@ -110,7 +102,7 @@ abstract class QuorumLockManager extends LockManager { foreach ( $pathsToUnlock as $bucket => $pathsToUnlockByType ) { $status->merge( $this->doUnlockingRequestBucket( $bucket, $pathsToUnlockByType ) ); } - if ( !count( $this->locksHeld ) ) { + if ( $this->locksHeld === [] ) { $status->merge( $this->releaseAllLocks() ); $this->degradedBuckets = []; // safe to retry the normal quorum } @@ -278,4 +270,12 @@ abstract class QuorumLockManager extends LockManager { * @return StatusValue */ abstract protected function releaseAllLocks(); + + final protected function doLock( array $paths, $type ) { + throw new LogicException( __METHOD__ . ': proxy class does not need this method.' ); + } + + final protected function doUnlock( array $paths, $type ) { + throw new LogicException( __METHOD__ . ': proxy class does not need this method.' ); + } }