From: Thalia Date: Fri, 23 Aug 2019 12:29:24 +0000 (+0100) Subject: Disambiguate confusing $fromReplica variable in BlockManager X-Git-Tag: 1.34.0-rc.0~578^2 X-Git-Url: https://git.cyclocoop.org/%27%20.%20%24this-%3EgetSkin%28%29-%3EescapeSearchLink%28%29%20.%20%27?a=commitdiff_plain;h=fc0067d7d56f9b59e591e0366a2e46d7ff1e1f64;p=lhc%2Fweb%2Fwiklou.git Disambiguate confusing $fromReplica variable in BlockManager Change-Id: Ifd9bfbc40a52add5e8478c31a55a1c22e9d4693d --- diff --git a/includes/block/BlockManager.php b/includes/block/BlockManager.php index 03043e1509..948ed930da 100644 --- a/includes/block/BlockManager.php +++ b/includes/block/BlockManager.php @@ -104,6 +104,7 @@ class BlockManager { */ public function getUserBlock( User $user, $fromReplica ) { $isAnon = $user->getId() === 0; + $fromMaster = !$fromReplica; // TODO: If $user is the current user, we should use the current request. Otherwise, // we should not look for XFF or cookie blocks. @@ -127,7 +128,7 @@ class BlockManager { // User/IP blocking // After this, $blocks is an array of blocks or an empty array // TODO: remove dependency on DatabaseBlock - $blocks = DatabaseBlock::newListFromTarget( $user, $ip, !$fromReplica ); + $blocks = DatabaseBlock::newListFromTarget( $user, $ip, $fromMaster ); // Cookie blocking $cookieBlock = $this->getBlockFromCookieValue( $user, $request ); @@ -164,7 +165,7 @@ class BlockManager { $xff = array_map( 'trim', explode( ',', $xff ) ); $xff = array_diff( $xff, [ $ip ] ); // TODO: remove dependency on DatabaseBlock - $xffblocks = DatabaseBlock::getBlocksForIPList( $xff, $isAnon, !$fromReplica ); + $xffblocks = DatabaseBlock::getBlocksForIPList( $xff, $isAnon, $fromMaster ); $blocks = array_merge( $blocks, $xffblocks ); }