X-Git-Url: https://git.cyclocoop.org/%28%28?a=blobdiff_plain;f=includes%2Fuser%2FBotPassword.php;h=fca777591e2062551be1b3e9edd91f6633b11c7c;hb=73e21844a3f437532c7f353a5ff67d6a3178b075;hp=286538b864db23be4f289d3edac06067af1cbbc3;hpb=53be5c92adab85c799754775e6b68c30fed6bf9c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/user/BotPassword.php b/includes/user/BotPassword.php index 286538b864..fca777591e 100644 --- a/includes/user/BotPassword.php +++ b/includes/user/BotPassword.php @@ -18,9 +18,6 @@ * http://www.gnu.org/copyleft/gpl.html */ -use MediaWiki\Session\BotPasswordSessionProvider; -use MediaWiki\Session\SessionInfo; - /** * Utility class for bot passwords * @since 1.27 @@ -102,6 +99,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 +337,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 +371,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',