* Moved variant language links on Cologne Blue and Nostalgia to before the
login/logout link
* Fix for parser tests with MySQL 5 in strict mode
+* Added block option "enable autoblocks"
== Languages updated ==
class Block
{
/* public*/ var $mAddress, $mUser, $mBy, $mReason, $mTimestamp, $mAuto, $mId, $mExpiry,
- $mRangeStart, $mRangeEnd, $mAnonOnly;
+ $mRangeStart, $mRangeEnd, $mAnonOnly, $mEnableAutoblock;
/* private */ var $mNetworkBits, $mIntegerAddr, $mForUpdate, $mFromMaster, $mByName;
const EB_KEEP_EXPIRED = 1;
const EB_RANGE_ONLY = 4;
function Block( $address = '', $user = 0, $by = 0, $reason = '',
- $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0 )
+ $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0 )
{
$this->mId = 0;
$this->mAddress = $address;
$this->mAnonOnly = $anonOnly;
$this->mCreateAccount = $createAccount;
$this->mExpiry = self::decodeExpiry( $expiry );
+ $this->mEnableAutoblock = $enableAutoblock;
$this->mForUpdate = false;
$this->mFromMaster = false;
{
$this->mAddress = $this->mReason = $this->mTimestamp = '';
$this->mId = $this->mAnonOnly = $this->mCreateAccount =
- $this->mAuto = $this->mUser = $this->mBy = 0;
+ $this->mEnableAutoblock = $this->mAuto = $this->mUser =
+ $this->mBy = 0;
$this->mByName = false;
}
$this->mAuto = $row->ipb_auto;
$this->mAnonOnly = $row->ipb_anon_only;
$this->mCreateAccount = $row->ipb_create_account;
+ $this->mEnableAutoblock = $row->ipb_enable_autoblock;
$this->mId = $row->ipb_id;
$this->mExpiry = self::decodeExpiry( $row->ipb_expiry );
if ( isset( $row->user_name ) ) {
'ipb_auto' => $this->mAuto,
'ipb_anon_only' => $this->mAnonOnly,
'ipb_create_account' => $this->mCreateAccount,
+ 'ipb_enable_autoblock' => $this->mEnableAutoblock,
'ipb_expiry' => self::encodeExpiry( $this->mExpiry, $dbw ),
'ipb_range_start' => $this->mRangeStart,
'ipb_range_end' => $this->mRangeEnd,
} else {
$this->BlockCreateAccount = $wgRequest->getBool( 'wpCreateAccount', true );
}
+
+ if ( $wgRequest->wasPosted() ) {
+ $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', false );
+ } else {
+ $this->BlockEnableAutoblock = $wgRequest->getBool( 'wpEnableAutoblock', true );
+ }
+
}
function showForm( $err ) {
array( 'tabindex' => 5 ) ) . "
</td>
</tr>
+ <tr>
+ <td> </td>
+ <td align=\"left\">
+ " . wfCheckLabel( wfMsg( 'ipbenableautoblock' ),
+ 'wpEnableAutoblock', 'wpEnableAutoblock', $this->BlockEnableAutoblock,
+ array( 'tabindex' => 6 ) ) . "
+ </td>
+ </tr>
<tr>
<td style='padding-top: 1em'> </td>
<td style='padding-top: 1em' align=\"left\">
- <input tabindex='5' type='submit' name=\"wpBlock\" value=\"{$mIpbsubmit}\" />
+ <input tabindex='7' type='submit' name=\"wpBlock\" value=\"{$mIpbsubmit}\" />
</td>
</tr>
</table>
$block = new Block( $this->BlockAddress, $userId, $wgUser->getID(),
$this->BlockReason, wfTimestampNow(), 0, $expiry, $this->BlockAnonOnly,
- $this->BlockCreateAccount );
+ $this->BlockCreateAccount, $this->BlockEnableAutoblock );
if (wfRunHooks('BlockIp', array(&$block, &$wgUser))) {
return;
}
+ if ( !$userblock->mEnableAutoblock ) {
+ return;
+ }
+
# Check if this IP address is already blocked
$ipblock = Block::newFromDB( wfGetIP() );
if ( $ipblock ) {
'ipbreason' => 'Reason',
'ipbanononly' => 'Block anonymous users only',
'ipbcreateaccount' => 'Prevent account creation',
+'ipbenableautoblock' => 'Automatically block IP addresses used by this user',
'ipbsubmit' => 'Block this user',
'ipbother' => 'Other time',
'ipboptions' => '2 hours:2 hours,1 day:1 day,3 days:3 days,1 week:1 week,2 weeks:2 weeks,1 month:1 month,3 months:3 months,6 months:6 months,1 year:1 year,infinite:infinite',
-- Block prevents account creation from matching IP addresses
ipb_create_account bool NOT NULL default 1,
+
+ -- Block triggers autoblocks
+ ipb_enable_autoblock bool NOT NULL default '1',
-- Time at which the block will expire.
ipb_expiry char(14) binary NOT NULL default '',
-- Block prevents account creation from matching IP addresses
ipb_create_account bool NOT NULL default 1,
+
+ -- Block triggers autoblocks
+ ipb_enable_autoblock bool NOT NULL default '1',
-- Time at which the block will expire.
ipb_expiry char(14) binary NOT NULL default '',
# table field patch file (in maintenance/archives)
array( 'ipblocks', 'ipb_id', 'patch-ipblocks.sql' ),
array( 'ipblocks', 'ipb_expiry', 'patch-ipb_expiry.sql' ),
+ array( 'ipblocks', 'ipb_enable_autoblock', 'patch-ipb_optional_autoblock.sql' ),
array( 'recentchanges', 'rc_type', 'patch-rc_type.sql' ),
array( 'recentchanges', 'rc_ip', 'patch-rc_ip.sql' ),
array( 'recentchanges', 'rc_id', 'patch-rc_id.sql' ),
-- New columns:
ALTER TABLE ipblocks ADD ipb_anon_only CHAR NOT NULL DEFAULT '0';
ALTER TABLE ipblocks ADD ipb_create_account CHAR NOT NULL DEFAULT '1';
+ALTER TABLE ipblocks ADD ipb_enable_autoblock CHAR NOT NULL default '1';
-- Index order rearrangements:
DROP INDEX pagelink_unique;