From: Brad Jorsch Date: Thu, 21 Jan 2016 20:06:02 +0000 (-0500) Subject: Add checks of $wgEnableBotPasswords in more places X-Git-Tag: 1.31.0-rc.0~8258^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22sites_tous%22%29%20.%20%22?a=commitdiff_plain;h=70b05d1ac1e859bac2185b246e9b93ec9051e4d8;p=lhc%2Fweb%2Fwiklou.git Add checks of $wgEnableBotPasswords in more places Bug: T124335 Change-Id: I3c13e7c7b84d5b72437f9ebdba35aad29b403b9c --- diff --git a/includes/user/BotPassword.php b/includes/user/BotPassword.php index 286538b864..6f713f1b29 100644 --- a/includes/user/BotPassword.php +++ b/includes/user/BotPassword.php @@ -102,6 +102,12 @@ class BotPassword implements IDBAccessObject { * @return BotPassword|null */ public static function newFromCentralId( $centralId, $appId, $flags = self::READ_NORMAL ) { + global $wgEnableBotPasswords; + + if ( !$wgEnableBotPasswords ) { + return null; + } + list( $index, $options ) = DBAccessObjectUtils::getDBOptions( $flags ); $db = self::getDB( $index ); $row = $db->selectRow( @@ -334,6 +340,12 @@ class BotPassword implements IDBAccessObject { * @return bool Whether any passwords were invalidated */ public static function invalidateAllPasswordsForCentralId( $centralId ) { + global $wgEnableBotPasswords; + + if ( !$wgEnableBotPasswords ) { + return false; + } + $dbw = self::getDB( DB_MASTER ); $dbw->update( 'bot_passwords', @@ -362,6 +374,12 @@ class BotPassword implements IDBAccessObject { * @return bool Whether any passwords were removed */ public static function removeAllPasswordsForCentralId( $centralId ) { + global $wgEnableBotPasswords; + + if ( !$wgEnableBotPasswords ) { + return false; + } + $dbw = self::getDB( DB_MASTER ); $dbw->delete( 'bot_passwords',