r94641 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94640‎ | r94641 | r94642 >
Date:14:48, 16 August 2011
Author:kbrown
Status:ok (Comments)
Tags:
Comment:
fix problem with ApiQueryArchiveFeed with improper paramater types and not continueing.
Modified paths:
  • /trunk/extensions/ArchiveLinks/ApiQueryArchiveFeed.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArchiveLinks/ApiQueryArchiveFeed.php
@@ -2,7 +2,7 @@
33
44 class ApiQueryArchiveFeed extends ApiQueryBase {
55 function __construct ( $query, $moduleName ) {
6 - parent::__construct( $query, $moduleName, 'al' );
 6+ parent::__construct( $query, $moduleName, 'arl' );
77 }
88
99 public function execute ( ) {
@@ -10,7 +10,7 @@
1111
1212 $this->addTables( 'el_archive_queue' );
1313 $this->addFields( '*' );
14 - $this->addWhereRange( 'insertion_time', $params['dir'], $params['start'], $params['end'] );
 14+ $this->addWhereRange( 'queue_id', $params['dir'], $params['start'], $params['end'] );
1515 $this->addOption( 'LIMIT', $params['limit'] + 1 );
1616
1717 $res = $this->select( __METHOD__ );
@@ -22,10 +22,11 @@
2323 foreach ( $res as $row ) {
2424 //much of this is stolen from ApiQueryRecentChanges
2525 if ( ++ $count > $params['limit'] ) {
26 - $this->setContinueEnumParameter( 'start', wfTimestamp( TS_UNIX, $row->insertion_time ) );
 26+ $this->setContinueEnumParameter( 'start', $row->queue_id );
2727 break;
2828 }
2929
 30+ $val['feed_id'] = $row->queue_id;
3031 $val['time'] = $row->insertion_time;
3132 $val['page_id'] = $row->page_id;
3233 $val['url'] = $row->url;
@@ -33,7 +34,7 @@
3435 $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $val );
3536
3637 if ( !$fit ) {
37 - $this->setContinueEnumParameter( 'start', wfTimestamp( TS_UNIX, $row->insertion_time ) );
 38+ $this->setContinueEnumParameter( 'start', $row->queue_id );
3839 break;
3940 }
4041 }
@@ -55,10 +56,10 @@
5657 ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
5758 ),
5859 'start' => array(
59 - ApiBase::PARAM_TYPE => 'timestamp'
 60+ ApiBase::PARAM_TYPE => 'integer'
6061 ),
6162 'end' => array(
62 - ApiBase::PARAM_TYPE => 'timestamp'
 63+ ApiBase::PARAM_TYPE => 'integer'
6364 ),
6465 'dir' => array(
6566 ApiBase::PARAM_DFLT => 'older',

Comments

#Comment by NeilK (talk | contribs)   15:54, 16 August 2011

Marking this 'ok' but I think it's safer to use a two-letter prefix. If somebody else picks 'ar', and then they have a parameter like 'arlist' then we get confusion. I gave you a list of the existing prefixes in another comment.

Status & tagging log