Index: trunk/phase3/includes/api/ApiQueryLogEvents.php |
— | — | @@ -148,6 +148,20 @@ |
149 | 149 | $index['logging'] = is_null( $user ) ? 'page_time' : array( 'page_time', 'user_time' ); |
150 | 150 | } |
151 | 151 | |
| 152 | + global $wgMiserMode; |
| 153 | + if ( !$wgMiserMode ) { |
| 154 | + $prefix = $params['prefix']; |
| 155 | + |
| 156 | + if ( !is_null( $prefix ) ) { |
| 157 | + $title = Title::newFromText( $prefix ); |
| 158 | + if ( is_null( $title ) ) { |
| 159 | + $this->dieUsage( "Bad title value '$prefix'", 'param_prefix' ); |
| 160 | + } |
| 161 | + $this->addWhereFld( 'log_namespace', $title->getNamespace() ); |
| 162 | + $this->addWhere( 'log_title ' . $db->buildLike( $title->getDBkey(), $db->anyString() ) ); |
| 163 | + } |
| 164 | + } |
| 165 | + |
152 | 166 | $this->addOption( 'USE INDEX', $index ); |
153 | 167 | |
154 | 168 | // Paranoia: avoid brute force searches (bug 17342) |
— | — | @@ -334,7 +348,7 @@ |
335 | 349 | |
336 | 350 | public function getAllowedParams() { |
337 | 351 | global $wgLogTypes, $wgLogActions; |
338 | | - return array( |
| 352 | + $ret = array( |
339 | 353 | 'prop' => array( |
340 | 354 | ApiBase::PARAM_ISMULTI => true, |
341 | 355 | ApiBase::PARAM_DFLT => 'ids|title|type|user|timestamp|comment|details', |
— | — | @@ -381,11 +395,17 @@ |
382 | 396 | ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 |
383 | 397 | ) |
384 | 398 | ); |
| 399 | + global $wgMiserMode; |
| 400 | + if ( !$wgMiserMode ) { |
| 401 | + $ret['prefix'] = null; |
| 402 | + } |
| 403 | + |
| 404 | + return $ret; |
385 | 405 | } |
386 | 406 | |
387 | 407 | public function getParamDescription() { |
388 | 408 | $p = $this->getModulePrefix(); |
389 | | - return array( |
| 409 | + $ret = array( |
390 | 410 | 'prop' => array( |
391 | 411 | 'Which properties to get', |
392 | 412 | ' ids - Adds the ID of the log event', |
— | — | @@ -409,6 +429,13 @@ |
410 | 430 | 'limit' => 'How many total event entries to return', |
411 | 431 | 'tag' => 'Only list event entries tagged with this tag', |
412 | 432 | ); |
| 433 | + |
| 434 | + global $wgMiserMode; |
| 435 | + if ( !$wgMiserMode ) { |
| 436 | + $ret['prefix'] = 'Filter entries that start with this prefix'; |
| 437 | + } |
| 438 | + |
| 439 | + return $ret; |
413 | 440 | } |
414 | 441 | |
415 | 442 | public function getDescription() { |
— | — | @@ -419,6 +446,7 @@ |
420 | 447 | return array_merge( parent::getPossibleErrors(), array( |
421 | 448 | array( 'code' => 'param_user', 'info' => 'User name $user not found' ), |
422 | 449 | array( 'code' => 'param_title', 'info' => 'Bad title value \'title\'' ), |
| 450 | + array( 'code' => 'param_prefix', 'info' => 'Bad title value \'prefix\'' ), |
423 | 451 | ) ); |
424 | 452 | } |
425 | 453 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -253,6 +253,8 @@ |
254 | 254 | * (bug 27203) add fato param to list=filearchive |
255 | 255 | * (bug 27341) Add drto param to list=deletedrevs |
256 | 256 | * (bug 26630) Add api for Special:ActiveUsers |
| 257 | +* (bug 27020) API: Allow title prefix search of logevents (only when not in |
| 258 | + miser mode) |
257 | 259 | |
258 | 260 | === Languages updated in 1.18 === |
259 | 261 | |