r43006 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43005‎ | r43006 | r43007 >
Date:18:15, 1 November 2008
Author:mrzman
Status:old
Tags:
Comment:
pass user ID to Block::newFromDB in case of renames per comments on r42843.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialBlockip.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialBlockip.php
@@ -87,6 +87,7 @@
8888 $mIpbreason = Xml::label( wfMsg( 'ipbotherreason' ), 'mw-bi-reason' );
8989
9090 $titleObj = SpecialPage::getTitleFor( 'Blockip' );
 91+ $user = User::newFromName( $this->BlockAddress );
9192
9293 $alreadyBlocked = false;
9394 if ( $err && $err[0] != 'ipb_already_blocked' ) {
@@ -95,7 +96,10 @@
9697 $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) );
9798 $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) );
9899 } elseif ( $this->BlockAddress ) {
99 - $currentBlock = Block::newFromDB( $this->BlockAddress );
 100+ $userId = 0;
 101+ if ( is_object( $user ) )
 102+ $userId = $user->getId();
 103+ $currentBlock = Block::newFromDB( $this->BlockAddress, $userId );
100104 if ( !is_null($currentBlock) && !$currentBlock->mAuto && !($currentBlock->mRangeStart && $currentBlock->mAddress != $this->BlockAddress) ) {
101105 $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress );
102106 $alreadyBlocked = true;
@@ -293,7 +297,6 @@
294298
295299 $wgOut->addHtml( $this->getConvenienceLinks() );
296300
297 - $user = User::newFromName( $this->BlockAddress );
298301 if( is_object( $user ) ) {
299302 $this->showLogFragment( $wgOut, $user->getUserPage() );
300303 } elseif( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $this->BlockAddress ) ) {
@@ -405,7 +408,7 @@
406409 return array( 'ipb_already_blocked' );
407410 } else {
408411 # This returns direct blocks before autoblocks/rangeblocks, since we should be sure the user is blocked by now it should work for our purposes
409 - $currentBlock = Block::newFromDB( $this->BlockAddress );
 412+ $currentBlock = Block::newFromDB( $this->BlockAddress, $userId );
410413 $currentBlock->delete();
411414 $block->insert();
412415 $log_action = 'reblock';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r42843(bug 10080) (bug 15820) - Allow modification of blocks without unblocking, an...mrzman21:45, 30 October 2008

Status & tagging log