) );
}
+ if ( !is_null( $params['show'] ) ) {
+ $show = array_flip( $params['show'] );
+
+ /* Check for conflicting parameters. */
+ if ( ( isset ( $show['account'] ) && isset ( $show['!account'] ) )
+ || ( isset ( $show['ip'] ) && isset ( $show['!ip'] ) )
+ || ( isset ( $show['range'] ) && isset ( $show['!range'] ) )
+ || ( isset ( $show['temp'] ) && isset ( $show['!temp'] ) )
+ ) {
+ $this->dieUsageMsg( 'show' );
+ }
+
+ $this->addWhereIf( 'ipb_user = 0', isset( $show['!account'] ) );
+ $this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) );
+ $this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) );
+ $this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) );
+ $this->addWhereIf( "ipb_expiry = 'infinity'", isset( $show['!temp'] ) );
+ $this->addWhereIf( "ipb_expiry != 'infinity'", isset( $show['temp'] ) );
+ $this->addWhereIf( "ipb_range_end = ipb_range_start", isset( $show['!range'] ) );
+ $this->addWhereIf( "ipb_range_end > ipb_range_start", isset( $show['range'] ) );
+ }
+
if ( !$wgUser->isAllowed( 'hideuser' ) ) {
$this->addWhereFld( 'ipb_deleted', 0 );
}
'flags'
),
ApiBase::PARAM_ISMULTI => true
- )
+ ),
+ 'show' => array(
+ ApiBase::PARAM_TYPE => array(
+ 'account',
+ '!account',
+ 'temp',
+ '!temp',
+ 'ip',
+ '!ip',
+ 'range',
+ '!range',
+ ),
+ ApiBase::PARAM_ISMULTI => true
+ ),
);
}
public function getParamDescription() {
+ $p = $this->getModulePrefix();
return array(
'start' => 'The timestamp to start enumerating from',
'end' => 'The timestamp to stop enumerating at',
- 'dir' => $this->getDirectionDescription( $this->getModulePrefix() ),
+ 'dir' => $this->getDirectionDescription( $p ),
'ids' => 'Pipe-separated list of block IDs to list (optional)',
'users' => 'Pipe-separated list of users to search for (optional)',
'ip' => array( 'Get all blocks applying to this IP or CIDR range, including range blocks.',
' range - Adds the range of IPs affected by the block',
' flags - Tags the ban with (autoblock, anononly, etc)',
),
+ 'show' => array(
+ 'Show only items that meet this criteria.',
+ "For example, to see only indefinite blocks on IPs, set {$p}show=ip|!temp"
+ ),
);
}
array( 'code' => 'cidrtoobroad', 'info' => 'CIDR ranges broader than /16 are not accepted' ),
array( 'code' => 'param_user', 'info' => 'User parameter may not be empty' ),
array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
+ array( 'show' ),
) );
}