r44765 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44764‎ | r44765 | r44766 >
Date:12:16, 18 December 2008
Author:ialex
Status:ok
Tags:
Comment:
Added support for APCOND_ISIP and APCOND_IPINRANGE conditions of $wgAutopromote
Modified paths:
  • /trunk/extensions/Configure/CHANGELOG (modified) (history)
  • /trunk/extensions/Configure/Configure.api.php (modified) (history)
  • /trunk/extensions/Configure/Configure.i18n.php (modified) (history)
  • /trunk/extensions/Configure/Configure.page.php (modified) (history)
  • /trunk/extensions/Configure/Configure.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Configure/Configure.api.php
@@ -254,7 +254,8 @@
255255 break;
256256 case 'promotion-conds':
257257 $opToName = array_flip( array( 'or' => '|', 'and' => '&', 'xor' => '^', 'not' => '!' ) );
258 - $condsName = array( 1 => 'editcount', 2 => 'age', 3 => 'emailconfirmed', 4 => 'in-groups' );
 258+ $condsName = array( 1 => 'editcount', 2 => 'age', 3 => 'emailconfirmed',
 259+ 4 => 'in-groups', 5 => 'is-ip', 6 => 'ip-in-range' );
259260 $validOps = array_keys( $opToName );
260261
261262 $settingRet['values'] = array();
Index: trunk/extensions/Configure/Configure.page.php
@@ -614,7 +614,8 @@
615615 break;
616616 case 'promotion-conds':
617617 $options = array( 'or' => '|', 'and' => '&', 'xor' => '^', 'not' => '!' );
618 - $conds = array( APCOND_EDITCOUNT => 'int', APCOND_AGE => 'int', APCOND_EMAILCONFIRMED => 'bool', APCOND_INGROUPS => 'array' );
 618+ $conds = array( APCOND_EDITCOUNT => 'int', APCOND_AGE => 'int', APCOND_EMAILCONFIRMED => 'bool',
 619+ APCOND_INGROUPS => 'array', APCOND_ISIP => 'text', APCOND_IPINRANGE => 'text' );
619620
620621 if ( isset( $_REQUEST['wp' . $name . '-vals'] ) ) {
621622 $groups = explode( "\n", trim( $wgRequest->getText( 'wp' . $name . '-vals' ) ) );
@@ -651,6 +652,11 @@
652653 if( $val )
653654 $condsVal[] = array( $condName, $val );
654655 break;
 656+ case 'text':
 657+ $val = $wgRequest->getVal( 'wp' . $name . '-' . $group . '-cond-' . $condName );
 658+ if( $val )
 659+ $condsVal[] = array( $condName, $val );
 660+ break;
655661 case 'array':
656662 $val = trim( $wgRequest->getText( 'wp' . $name . '-' . $group . '-cond-' . $condName ) );
657663 if( !$val )
@@ -1328,7 +1334,8 @@
13291335 */
13301336 public static function buildPromotionCondsSettingRow( $conf, $allowed, $group, $groupConds ){
13311337 static $options = array( 'or' => '|', 'and' => '&', 'xor' => '^', 'not' => '!' );
1332 - static $conds = array( APCOND_EDITCOUNT => 'int', APCOND_AGE => 'int', APCOND_EMAILCONFIRMED => 'bool', APCOND_INGROUPS => 'array' );
 1338+ static $conds = array( APCOND_EDITCOUNT => 'int', APCOND_AGE => 'int', APCOND_EMAILCONFIRMED => 'bool',
 1339+ APCOND_INGROUPS => 'array', APCOND_ISIP => 'text', APCOND_IPINRANGE => 'text' );
13331340
13341341 $row = '<div class="configure-biglist promotion-conds-element">';
13351342 $row .= wfMsgHtml( 'configure-condition-operator' ) . ' ';
@@ -1376,8 +1383,10 @@
13771384 $row .= Xml::check( $encId.'-cond-'.$condName, isset( $condsVal[$condName] ) && $condsVal[$condName],
13781385 array( 'id' => $encId.'-cond-'.$condName ) + $extra ) . "<br />\n";
13791386 break;
 1387+ case 'text':
13801388 case 'int':
1381 - $row .= Xml::input( $encId.'-cond-'.$condName, 20, isset( $condsVal[$condName] ) ? $condsVal[$condName] : 0, $extra ) . "<br />\n";
 1389+ $row .= Xml::input( $encId.'-cond-'.$condName, ( $condType == 'int' ? 20 : 40 ),
 1390+ isset( $condsVal[$condName] ) ? $condsVal[$condName] : ( $condType == 'int' ? 0 : '' ), $extra ) . "<br />\n";
13821391 break;
13831392 case 'array':
13841393 $id = "{$encId}-cond-{$condName}";
Index: trunk/extensions/Configure/CHANGELOG
@@ -1,6 +1,10 @@
22 This file lists changes on this extension.
33 Localisation updates are done on betawiki and aren't listed here.
44
 5+0.11.2 - 18 December 2008
 6+ Added support for APCOND_ISIP and APCOND_IPINRANGE conditions of
 7+ $wgAutopromote.
 8+
59 0.11.1 - 13 December 2008
610 Added $wgEnableSerializedMessages.
711
Index: trunk/extensions/Configure/Configure.php
@@ -17,7 +17,7 @@
1818 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure',
1919 'description' => 'Allow authorised users to configure the wiki via a web-based interface',
2020 'descriptionmsg' => 'configure-desc',
21 - 'version' => '0.11.1',
 21+ 'version' => '0.11.2',
2222 );
2323
2424 # Configuration part
Index: trunk/extensions/Configure/Configure.i18n.php
@@ -187,12 +187,16 @@
188188 'configure-condition-name-2' => 'Minimal age',
189189 'configure-condition-name-3' => 'E-mail confirmed',
190190 'configure-condition-name-4' => 'In groups',
 191+ 'configure-condition-name-5' => 'User\'s IP',
 192+ 'configure-condition-name-6' => 'IP in CDIR range',
191193 'configure-autopromote-noconds' => 'No prerequisites',
192194
193195 'configure-condition-description-1' => 'Minimum edit count of $1',
194196 'configure-condition-description-2' => 'Minimum account age of $1 {{PLURAL:$1|second|seconds}}',
195197 'configure-condition-description-3' => 'E-mail confirmed',
196198 'configure-condition-description-4' => 'In all of the groups $1',
 199+ 'configure-condition-description-5' => 'User\'s IP is $1',
 200+ 'configure-condition-description-6' => 'User\'s IP in $1 range',
197201
198202 'configure-boolop-description-and' => 'All conditions must be true',
199203 'configure-boolop-description-or' => 'At least one condition must be true',

Status & tagging log