From: Aaron Schulz Date: Thu, 12 May 2016 20:02:41 +0000 (-0700) Subject: Make User::isBot() also check the "bot" right for sanity X-Git-Tag: 1.31.0-rc.0~6988^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22auteur_infos%22%2C%20%22id_auteur=%24id%22%29%20.%20%22?a=commitdiff_plain;h=911fc2cd8664613e39c2b8cb257c654b0a8934cb;p=lhc%2Fweb%2Fwiklou.git Make User::isBot() also check the "bot" right for sanity Change-Id: I835cc23719c1975bb86f642d3ede36c882ce2e9b --- 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; } /**