Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -54,6 +54,8 @@ |
55 | 55 | a best effort language name translation. Use CLDR extension for best result. |
56 | 56 | * (bug 30230) action=expandtemplates should not silently override invalid title inputs |
57 | 57 | * (bug 18634) Create API to fetch MediaWiki's language fallback tree structure |
| 58 | +* (bug 26885) Allow show/hide of account blocks, temporary blocks and single IP blocks |
| 59 | + for list=blocks |
58 | 60 | |
59 | 61 | === Languages updated in 1.19 === |
60 | 62 | |
Index: trunk/phase3/includes/api/ApiQueryBlocks.php |
— | — | @@ -114,6 +114,28 @@ |
115 | 115 | ) ); |
116 | 116 | } |
117 | 117 | |
| 118 | + if ( !is_null( $params['show'] ) ) { |
| 119 | + $show = array_flip( $params['show'] ); |
| 120 | + |
| 121 | + /* Check for conflicting parameters. */ |
| 122 | + if ( ( isset ( $show['account'] ) && isset ( $show['!account'] ) ) |
| 123 | + || ( isset ( $show['ip'] ) && isset ( $show['!ip'] ) ) |
| 124 | + || ( isset ( $show['range'] ) && isset ( $show['!range'] ) ) |
| 125 | + || ( isset ( $show['temp'] ) && isset ( $show['!temp'] ) ) |
| 126 | + ) { |
| 127 | + $this->dieUsageMsg( 'show' ); |
| 128 | + } |
| 129 | + |
| 130 | + $this->addWhereIf( 'ipb_user = 0', isset( $show['!account'] ) ); |
| 131 | + $this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) ); |
| 132 | + $this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) ); |
| 133 | + $this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) ); |
| 134 | + $this->addWhereIf( "ipb_expiry = 'infinity'", isset( $show['!temp'] ) ); |
| 135 | + $this->addWhereIf( "ipb_expiry != 'infinity'", isset( $show['temp'] ) ); |
| 136 | + $this->addWhereIf( "ipb_range_end = ipb_range_start", isset( $show['!range'] ) ); |
| 137 | + $this->addWhereIf( "ipb_range_end > ipb_range_start", isset( $show['range'] ) ); |
| 138 | + } |
| 139 | + |
118 | 140 | if ( !$wgUser->isAllowed( 'hideuser' ) ) { |
119 | 141 | $this->addWhereFld( 'ipb_deleted', 0 ); |
120 | 142 | } |
— | — | @@ -252,15 +274,29 @@ |
253 | 275 | 'flags' |
254 | 276 | ), |
255 | 277 | ApiBase::PARAM_ISMULTI => true |
256 | | - ) |
| 278 | + ), |
| 279 | + 'show' => array( |
| 280 | + ApiBase::PARAM_TYPE => array( |
| 281 | + 'account', |
| 282 | + '!account', |
| 283 | + 'temp', |
| 284 | + '!temp', |
| 285 | + 'ip', |
| 286 | + '!ip', |
| 287 | + 'range', |
| 288 | + '!range', |
| 289 | + ), |
| 290 | + ApiBase::PARAM_ISMULTI => true |
| 291 | + ), |
257 | 292 | ); |
258 | 293 | } |
259 | 294 | |
260 | 295 | public function getParamDescription() { |
| 296 | + $p = $this->getModulePrefix(); |
261 | 297 | return array( |
262 | 298 | 'start' => 'The timestamp to start enumerating from', |
263 | 299 | 'end' => 'The timestamp to stop enumerating at', |
264 | | - 'dir' => $this->getDirectionDescription( $this->getModulePrefix() ), |
| 300 | + 'dir' => $this->getDirectionDescription( $p ), |
265 | 301 | 'ids' => 'Pipe-separated list of block IDs to list (optional)', |
266 | 302 | 'users' => 'Pipe-separated list of users to search for (optional)', |
267 | 303 | 'ip' => array( 'Get all blocks applying to this IP or CIDR range, including range blocks.', |
— | — | @@ -279,6 +315,10 @@ |
280 | 316 | ' range - Adds the range of IPs affected by the block', |
281 | 317 | ' flags - Tags the ban with (autoblock, anononly, etc)', |
282 | 318 | ), |
| 319 | + 'show' => array( |
| 320 | + 'Show only items that meet this criteria.', |
| 321 | + "For example, to see only indefinite blocks on IPs, set {$p}show=ip|!temp" |
| 322 | + ), |
283 | 323 | ); |
284 | 324 | } |
285 | 325 | |
— | — | @@ -292,6 +332,7 @@ |
293 | 333 | array( 'code' => 'cidrtoobroad', 'info' => 'CIDR ranges broader than /16 are not accepted' ), |
294 | 334 | array( 'code' => 'param_user', 'info' => 'User parameter may not be empty' ), |
295 | 335 | array( 'code' => 'param_user', 'info' => 'User name user is not valid' ), |
| 336 | + array( 'show' ), |
296 | 337 | ) ); |
297 | 338 | } |
298 | 339 | |