From 911fc2cd8664613e39c2b8cb257c654b0a8934cb Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Thu, 12 May 2016 13:02:41 -0700 Subject: [PATCH] Make User::isBot() also check the "bot" right for sanity Change-Id: I835cc23719c1975bb86f642d3ede36c882ce2e9b --- includes/user/User.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/user/User.php b/includes/user/User.php index 3d7d71c1b8..b62d2525ef 100644 --- a/includes/user/User.php +++ b/includes/user/User.php @@ -3403,12 +3403,14 @@ class User implements IDBAccessObject { * @since 1.28 */ public function isBot() { - $isBot = false; - if ( !Hooks::run( "UserIsBot", [ $this, &$isBot ] ) ) { - return $isBot; + if ( in_array( 'bot', $this->getGroups() ) && $this->isAllowed( 'bot' ) ) { + return true; } - return ( $isBot || in_array( 'bot', $this->getGroups() ) ); + $isBot = false; + Hooks::run( "UserIsBot", [ $this, &$isBot ] ); + + return $isBot; } /** -- 2.20.1