http://www.mediawiki.org/wiki/Special:Code/MediaWiki/83755
Revision: 83755 Author: happy-melon Date: 2011-03-12 12:13:22 +0000 (Sat, 12 Mar 2011) Log Message: ----------- Deprecate $wgSysopUserBans and $wgSysopRangeBans, both of which are pre-1.2, and totally antiquated. Can't think of any reason why a modern wiki might want to make blocks IP-only; syadmins can still disable rangeblocks by setting $wgBlockCIDRLimit to the maximum for each IP mode (32 for IP4, 128 for IP6). Modified Paths: -------------- trunk/extensions/CleanChanges/CleanChanges_body.php trunk/phase3/includes/DefaultSettings.php trunk/phase3/includes/Linker.php trunk/phase3/includes/specials/SpecialBlockip.php trunk/phase3/includes/specials/SpecialContributions.php trunk/phase3/includes/specials/SpecialDeletedContributions.php trunk/phase3/includes/specials/SpecialIpblocklist.php Modified: trunk/extensions/CleanChanges/CleanChanges_body.php =================================================================== --- trunk/extensions/CleanChanges/CleanChanges_body.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/extensions/CleanChanges/CleanChanges_body.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -432,9 +432,8 @@ * Enhanced user tool links, with javascript functionality. */ public function userToolLinks( $userId, $userText ) { - global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans; + global $wgUser, $wgDisableAnonTalk; $talkable = !( $wgDisableAnonTalk && 0 == $userId ); - $blockable = ( $wgSysopUserBans || 0 == $userId ); /* * Assign each different user a running id. This is used to show user tool @@ -483,7 +482,7 @@ $items[] = $this->skin->makeKnownLinkObj( $targetPage, wfMsgHtml( 'contribslink' ) ); } - if( $blockable && $wgUser->isAllowed( 'block' ) ) { + if( $wgUser->isAllowed( 'block' ) ) { $items[] = $this->skin->blockLink( $userId, $userText ); } if( $userId ) { Modified: trunk/phase3/includes/DefaultSettings.php =================================================================== --- trunk/phase3/includes/DefaultSettings.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/phase3/includes/DefaultSettings.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -3175,10 +3175,16 @@ * @{ */ -/** Allow sysops to ban logged-in users */ +/** + * Allow sysops to ban logged-in users + * @deprecated @since 1.18 + */ $wgSysopUserBans = true; -/** Allow sysops to ban IP ranges */ +/** + * Allow sysops to ban IP ranges + * @deprecated @since 1.18; set $wgBlockCIDRLimit to array( 'IPv4' => 32, 'IPv6 => 128 ) instead. + */ $wgSysopRangeBans = true; /** Modified: trunk/phase3/includes/Linker.php =================================================================== --- trunk/phase3/includes/Linker.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/phase3/includes/Linker.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -880,9 +880,9 @@ * @return String: HTML fragment */ public function userToolLinks( $userId, $userText, $redContribsWhenNoEdits = false, $flags = 0, $edits = null ) { - global $wgUser, $wgDisableAnonTalk, $wgSysopUserBans, $wgLang; + global $wgUser, $wgDisableAnonTalk, $wgLang; $talkable = !( $wgDisableAnonTalk && 0 == $userId ); - $blockable = ( $wgSysopUserBans || 0 == $userId ) && !$flags & self::TOOL_LINKS_NOBLOCK; + $blockable = !$flags & self::TOOL_LINKS_NOBLOCK; $items = array(); if ( $talkable ) { Modified: trunk/phase3/includes/specials/SpecialBlockip.php =================================================================== --- trunk/phase3/includes/specials/SpecialBlockip.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/phase3/includes/specials/SpecialBlockip.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -106,16 +106,12 @@ } public function showForm( $err ) { - global $wgOut, $wgUser, $wgSysopUserBans; + global $wgOut, $wgUser; $wgOut->setPageTitle( wfMsg( 'blockip-title' ) ); $wgOut->addWikiMsg( 'blockiptext' ); - if( $wgSysopUserBans ) { - $mIpaddress = Xml::label( wfMsg( 'ipadressorusername' ), 'mw-bi-target' ); - } else { - $mIpaddress = Xml::label( wfMsg( 'ipaddress' ), 'mw-bi-target' ); - } + $mIpaddress = Xml::label( wfMsg( 'ipadressorusername' ), 'mw-bi-target' ); $mIpbexpiry = Xml::label( wfMsg( 'ipbexpiry' ), 'wpBlockExpiry' ); $mIpbother = Xml::label( wfMsg( 'ipbother' ), 'mw-bi-other' ); $mIpbreasonother = Xml::label( wfMsg( 'ipbreason' ), 'wpBlockReasonList' ); @@ -426,7 +422,7 @@ * @return array(message key, arguments) on failure, empty array on success */ function doBlock( &$userId = null, &$expiry = null ) { - global $wgUser, $wgSysopUserBans, $wgSysopRangeBans, $wgBlockAllowsUTEdit, $wgBlockCIDRLimit; + global $wgUser, $wgBlockAllowsUTEdit, $wgBlockCIDRLimit; $userId = 0; # Expand valid IPv6 addresses, usernames are left as is @@ -441,7 +437,7 @@ $matches = array(); if( preg_match( "/^($rxIP4)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) { # IPv4 - if( $wgSysopRangeBans ) { + if( $wgBlockCIDRLimit['IPv4'] != 32 ){ if( !IP::isIPv4( $this->BlockAddress ) || $matches[2] > 32 ) { return array( 'ip_range_invalid' ); } elseif ( $matches[2] < $wgBlockCIDRLimit['IPv4'] ) { @@ -454,7 +450,7 @@ } } elseif( preg_match( "/^($rxIP6)\\/(\\d{1,3})$/", $this->BlockAddress, $matches ) ) { # IPv6 - if( $wgSysopRangeBans ) { + if( $wgBlockCIDRLimit['IPv6'] != 128 ) { if( !IP::isIPv6( $this->BlockAddress ) || $matches[2] > 128 ) { return array( 'ip_range_invalid' ); } elseif( $matches[2] < $wgBlockCIDRLimit['IPv6'] ) { @@ -467,17 +463,13 @@ } } else { # Username block - if( $wgSysopUserBans ) { - $user = User::newFromName( $this->BlockAddress ); - if( $user instanceof User && $user->getId() ) { - # Use canonical name - $userId = $user->getId(); - $this->BlockAddress = $user->getName(); - } else { - return array( 'nosuchusershort', htmlspecialchars( $user ? $user->getName() : $this->BlockAddress ) ); - } + $user = User::newFromName( $this->BlockAddress ); + if( $user instanceof User && $user->getId() ) { + # Use canonical name + $userId = $user->getId(); + $this->BlockAddress = $user->getName(); } else { - return array( 'badipaddress' ); + return array( 'nosuchusershort', htmlspecialchars( $user ? $user->getName() : $this->BlockAddress ) ); } } } Modified: trunk/phase3/includes/specials/SpecialContributions.php =================================================================== --- trunk/phase3/includes/specials/SpecialContributions.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/phase3/includes/specials/SpecialContributions.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -240,7 +240,6 @@ * @param $subject User: The viewing user ($wgUser is still checked in some cases, like userrights page!!) */ public static function getUserLinks( Title $userpage, Title $talkpage, User $target, User $subject ) { - global $wgSysopUserBans; $sk = $subject->getSkin(); $id = $target->getId(); @@ -248,7 +247,7 @@ $tools[] = $sk->link( $talkpage, wfMsgHtml( 'sp-contributions-talk' ) ); - if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $username ) ) ) { + if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $username ) ) ) { if( $subject->isAllowed( 'block' ) ) { # Block / Change block / Unblock links if ( $target->isBlocked() ) { $tools[] = $sk->linkKnown( # Change block link Modified: trunk/phase3/includes/specials/SpecialDeletedContributions.php =================================================================== --- trunk/phase3/includes/specials/SpecialDeletedContributions.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/phase3/includes/specials/SpecialDeletedContributions.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -354,7 +354,7 @@ * @todo Fixme: almost the same as contributionsSub in SpecialContributions.php. Could be combined. */ function getSubTitle( $nt, $id ) { - global $wgSysopUserBans, $wgLang, $wgUser, $wgOut; + global $wgLang, $wgUser, $wgOut; $sk = $wgUser->getSkin(); @@ -368,7 +368,7 @@ if( $talk ) { # Talk page link $tools[] = $sk->link( $talk, wfMsgHtml( 'sp-contributions-talk' ) ); - if( ( $id !== null && $wgSysopUserBans ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) { + if( ( $id !== null ) || ( $id === null && IP::isIPAddress( $nt->getText() ) ) ) { if( $wgUser->isAllowed( 'block' ) ) { # Block / Change block / Unblock links if ( $userObj->isBlocked() ) { $tools[] = $sk->linkKnown( # Change block link Modified: trunk/phase3/includes/specials/SpecialIpblocklist.php =================================================================== --- trunk/phase3/includes/specials/SpecialIpblocklist.php 2011-03-12 12:05:17 UTC (rev 83754) +++ trunk/phase3/includes/specials/SpecialIpblocklist.php 2011-03-12 12:13:22 UTC (rev 83755) @@ -121,7 +121,7 @@ * @return $out string: HTML form */ function showForm( $err = null ) { - global $wgOut, $wgUser, $wgSysopUserBans; + global $wgOut, $wgUser; $wgOut->addWikiMsg( 'unblockiptext' ); @@ -139,12 +139,12 @@ $encName = htmlspecialchars( $block->getRedactedName() ); $encId = $this->id; $addressPart = $encName . Html::hidden( 'id', $encId ); - $ipa = wfMsgHtml( $wgSysopUserBans ? 'ipadressorusername' : 'ipaddress' ); + $ipa = wfMsgHtml( 'ipadressorusername' ); } } if ( !$addressPart ) { $addressPart = Xml::input( 'wpUnblockAddress', 40, $this->ip, array( 'type' => 'text', 'tabindex' => '1' ) ); - $ipa = Xml::label( wfMsg( $wgSysopUserBans ? 'ipadressorusername' : 'ipaddress' ), 'wpUnblockAddress' ); + $ipa = Xml::label( wfMsg( 'ipadressorusername' ), 'wpUnblockAddress' ); } $wgOut->addHTML( _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs