From: Alex Z Date: Sat, 1 Nov 2008 18:15:45 +0000 (+0000) Subject: pass user ID to Block::newFromDB in case of renames per comments on r42843. X-Git-Tag: 1.31.0-rc.0~44480 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%7B%7B%20url_for%28%27vote%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=d582e67ce86a48314899495e3774ca44741d2206;p=lhc%2Fweb%2Fwiklou.git pass user ID to Block::newFromDB in case of renames per comments on r42843. --- diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index d855e68989..c04cf960ef 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -87,6 +87,7 @@ class IPBlockForm { $mIpbreason = Xml::label( wfMsg( 'ipbotherreason' ), 'mw-bi-reason' ); $titleObj = SpecialPage::getTitleFor( 'Blockip' ); + $user = User::newFromName( $this->BlockAddress ); $alreadyBlocked = false; if ( $err && $err[0] != 'ipb_already_blocked' ) { @@ -95,7 +96,10 @@ class IPBlockForm { $wgOut->setSubtitle( wfMsgHtml( 'formerror' ) ); $wgOut->addHTML( Xml::tags( 'p', array( 'class' => 'error' ), $msg ) ); } elseif ( $this->BlockAddress ) { - $currentBlock = Block::newFromDB( $this->BlockAddress ); + $userId = 0; + if ( is_object( $user ) ) + $userId = $user->getId(); + $currentBlock = Block::newFromDB( $this->BlockAddress, $userId ); if ( !is_null($currentBlock) && !$currentBlock->mAuto && !($currentBlock->mRangeStart && $currentBlock->mAddress != $this->BlockAddress) ) { $wgOut->addWikiMsg( 'ipb-needreblock', $this->BlockAddress ); $alreadyBlocked = true; @@ -293,7 +297,6 @@ class IPBlockForm { $wgOut->addHtml( $this->getConvenienceLinks() ); - $user = User::newFromName( $this->BlockAddress ); if( is_object( $user ) ) { $this->showLogFragment( $wgOut, $user->getUserPage() ); } elseif( preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/', $this->BlockAddress ) ) { @@ -405,7 +408,7 @@ class IPBlockForm { return array( 'ipb_already_blocked' ); } else { # This returns direct blocks before autoblocks/rangeblocks, since we should be sure the user is blocked by now it should work for our purposes - $currentBlock = Block::newFromDB( $this->BlockAddress ); + $currentBlock = Block::newFromDB( $this->BlockAddress, $userId ); $currentBlock->delete(); $block->insert(); $log_action = 'reblock';