$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->selectRow(
'ipblocks',
- '*',
+ self::selectFields(),
array( 'ipb_id' => $id ),
__METHOD__
);
if ( $res ) {
- return Block::newFromRow( $res );
+ return self::newFromRow( $res );
} else {
return null;
}
}
+ /**
+ * Return the list of ipblocks fields that should be selected to create
+ * a new block.
+ * @return array
+ */
+ public static function selectFields() {
+ return array(
+ 'ipb_id',
+ 'ipb_address',
+ 'ipb_by',
+ 'ipb_by_text',
+ 'ipb_reason',
+ 'ipb_timestamp',
+ 'ipb_auto',
+ 'ipb_anon_only',
+ 'ipb_create_account',
+ 'ipb_enable_autoblock',
+ 'ipb_expiry',
+ 'ipb_deleted',
+ 'ipb_block_email',
+ 'ipb_allow_usertalk',
+ 'ipb_parent_block_id',
+ );
+ }
+
/**
* Check if two blocks are effectively equal. Doesn't check irrelevant things like
* the blocking user or the block timestamp, only things which affect the blocked user *
}
}
- $res = $db->select( 'ipblocks', '*', $conds, __METHOD__ );
+ $res = $db->select( 'ipblocks', self::selectFields(), $conds, __METHOD__ );
# This result could contain a block on the user, a block on the IP, and a russian-doll
# set of rangeblocks. We want to choose the most specific one, so keep a leader board.
$bestBlockPreventsEdit = null;
foreach( $res as $row ){
- $block = Block::newFromRow( $row );
+ $block = self::newFromRow( $row );
# Don't use expired blocks
if( $block->deleteIfExpired() ){
$key = wfMemcKey( 'ipb', 'autoblock', 'whitelist' );
$lines = $wgMemc->get( $key );
if ( !$lines ) {
- $lines = explode( "\n", wfMsgForContentNoTrans( 'autoblock_whitelist' ) );
+ $lines = explode( "\n", wfMessage( 'autoblock_whitelist' )->inContentLanguage()->plain() );
$wgMemc->set( $key, $lines, 3600 * 24 );
}
wfDebug( "Autoblocking {$this->getTarget()}@" . $autoblockIP . "\n" );
$autoblock->setTarget( $autoblockIP );
$autoblock->setBlocker( $this->getBlocker() );
- $autoblock->mReason = wfMsgForContent( 'autoblocker', $this->getTarget(), $this->mReason );
+ $autoblock->mReason = wfMessage( 'autoblocker', $this->getTarget(), $this->mReason )->inContentLanguage()->text();
$timestamp = wfTimestampNow();
$autoblock->mTimestamp = $timestamp;
$autoblock->mAuto = 1;
$keys = array( 'infiniteblock', 'expiringblock' );
foreach ( $keys as $key ) {
- $msg[$key] = wfMsgHtml( $key );
+ $msg[$key] = wfMessage( $key )->escaped();
}
}