From: Victor Vasiliev Date: Sun, 31 Jan 2010 01:16:55 +0000 (+0000) Subject: Modify IPBlockForm::(un)suppressUserName so it can be used on a different database. X-Git-Tag: 1.31.0-rc.0~38022 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28?a=commitdiff_plain;h=ebfc767db36e6d75361a2bb90f966bb74b46cbf8;p=lhc%2Fweb%2Fwiklou.git Modify IPBlockForm::(un)suppressUserName so it can be used on a different database. --- diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index ceef42db22..16720dd131 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -539,19 +539,20 @@ class IPBlockForm { } } - public static function suppressUserName( $name, $userId ) { + public static function suppressUserName( $name, $userId, $dbw = null ) { $op = '|'; // bitwise OR - return self::setUsernameBitfields( $name, $userId, $op ); + return self::setUsernameBitfields( $name, $userId, $op, $dbw ); } - public static function unsuppressUserName( $name, $userId ) { + public static function unsuppressUserName( $name, $userId, $dbw = null ) { $op = '&'; // bitwise AND - return self::setUsernameBitfields( $name, $userId, $op ); + return self::setUsernameBitfields( $name, $userId, $op, $dbw ); } - private static function setUsernameBitfields( $name, $userId, $op ) { + private static function setUsernameBitfields( $name, $userId, $op, $dbw ) { if( $op !== '|' && $op !== '&' ) return false; // sanity check - $dbw = wfGetDB( DB_MASTER ); + if( !$dbw ) + $dbw = wfGetDB( DB_MASTER ); $delUser = Revision::DELETED_USER | Revision::DELETED_RESTRICTED; $delAction = LogPage::DELETED_ACTION | Revision::DELETED_RESTRICTED; # Normalize user name