r93857 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93856‎ | r93857 | r93858 >
Date:21:44, 3 August 2011
Author:kbrown
Status:ok (Comments)
Tags:
Comment:
fix EOL style from r83856.
Modified paths:
  • /trunk/extensions/ArchiveLinks/ApiQueryArchiveFeed.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArchiveLinks/ApiQueryArchiveFeed.php
@@ -1,72 +1,72 @@
2 -<?php
3 -
4 -class ApiQueryArchiveFeed extends ApiQueryBase {
5 - function __construct ( $query, $moduleName ) {
6 - parent::__construct( $query, $moduleName, 'al' );
7 - }
8 -
9 - public function execute ( ) {
10 - $params = $this->extractRequestParams();
11 -
12 - $this->addTables( 'el_archive_queue' );
13 - $this->addFields( '*' );
14 - $this->addWhereRange( 'insertion_time', $params['dir'], $params['start'], $params['end'] );
15 - $this->addOption( 'LIMIT', $params['limit'] + 1 );
16 -
17 - $res = $this->select( __METHOD__ );
18 -
19 - $val = array( );
20 - $count = 0;
21 - $result = $this->getResult();
22 -
23 - foreach ( $res as $row ) {
24 - //much of this is stolen from ApiQueryRecentChanges
25 - if ( ++ $count > $params['limit'] ) {
26 - $this->setContinueEnumParameter( 'start', wfTimestamp( TS_UNIX, $row->insertion_time ) );
27 - break;
28 - }
29 -
30 - $val['time'] = $row->insertion_time;
31 - $val['page_id'] = $row->page_id;
32 - $val['url'] = $row->url;
33 -
34 - $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $val );
35 -
36 - if ( !$fit ) {
37 - $this->setContinueEnumParameter( 'start', wfTimestamp( TS_UNIX, $row->insertion_time ) );
38 - break;
39 - }
40 - }
41 -
42 - $result = $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'al' );
43 - }
44 -
45 - function getVersion() {
46 - return __CLASS__;
47 - }
48 -
49 - function getAllowedParams() {
50 - return array(
51 - 'limit' => array(
52 - ApiBase::PARAM_DFLT => 10,
53 - ApiBase::PARAM_TYPE => 'limit',
54 - ApiBase::PARAM_MIN => 1,
55 - ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
56 - ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
57 - ),
58 - 'start' => array(
59 - ApiBase::PARAM_TYPE => 'timestamp'
60 - ),
61 - 'end' => array(
62 - ApiBase::PARAM_TYPE => 'timestamp'
63 - ),
64 - 'dir' => array(
65 - ApiBase::PARAM_DFLT => 'older',
66 - ApiBase::PARAM_TYPE => array(
67 - 'newer',
68 - 'older'
69 - )
70 - )
71 - );
72 - }
 2+<?php
 3+
 4+class ApiQueryArchiveFeed extends ApiQueryBase {
 5+ function __construct ( $query, $moduleName ) {
 6+ parent::__construct( $query, $moduleName, 'al' );
 7+ }
 8+
 9+ public function execute ( ) {
 10+ $params = $this->extractRequestParams();
 11+
 12+ $this->addTables( 'el_archive_queue' );
 13+ $this->addFields( '*' );
 14+ $this->addWhereRange( 'insertion_time', $params['dir'], $params['start'], $params['end'] );
 15+ $this->addOption( 'LIMIT', $params['limit'] + 1 );
 16+
 17+ $res = $this->select( __METHOD__ );
 18+
 19+ $val = array( );
 20+ $count = 0;
 21+ $result = $this->getResult();
 22+
 23+ foreach ( $res as $row ) {
 24+ //much of this is stolen from ApiQueryRecentChanges
 25+ if ( ++ $count > $params['limit'] ) {
 26+ $this->setContinueEnumParameter( 'start', wfTimestamp( TS_UNIX, $row->insertion_time ) );
 27+ break;
 28+ }
 29+
 30+ $val['time'] = $row->insertion_time;
 31+ $val['page_id'] = $row->page_id;
 32+ $val['url'] = $row->url;
 33+
 34+ $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $val );
 35+
 36+ if ( !$fit ) {
 37+ $this->setContinueEnumParameter( 'start', wfTimestamp( TS_UNIX, $row->insertion_time ) );
 38+ break;
 39+ }
 40+ }
 41+
 42+ $result = $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'al' );
 43+ }
 44+
 45+ function getVersion() {
 46+ return __CLASS__;
 47+ }
 48+
 49+ function getAllowedParams() {
 50+ return array(
 51+ 'limit' => array(
 52+ ApiBase::PARAM_DFLT => 10,
 53+ ApiBase::PARAM_TYPE => 'limit',
 54+ ApiBase::PARAM_MIN => 1,
 55+ ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
 56+ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
 57+ ),
 58+ 'start' => array(
 59+ ApiBase::PARAM_TYPE => 'timestamp'
 60+ ),
 61+ 'end' => array(
 62+ ApiBase::PARAM_TYPE => 'timestamp'
 63+ ),
 64+ 'dir' => array(
 65+ ApiBase::PARAM_DFLT => 'older',
 66+ ApiBase::PARAM_TYPE => array(
 67+ 'newer',
 68+ 'older'
 69+ )
 70+ )
 71+ );
 72+ }
7373 }
\ No newline at end of file
Property changes on: trunk/extensions/ArchiveLinks/ApiQueryArchiveFeed.php
___________________________________________________________________
Added: svn:eol-style
7474 + native

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93856Add archive feed API list module for external archival services.kbrown21:42, 3 August 2011

Comments

#Comment by Reedy (talk | contribs)   22:01, 3 August 2011

Wrong revision tagged as followup

#Comment by Kevin Brown (talk | contribs)   15:44, 4 August 2011

Oops! Meant. r93856

Status & tagging log