r72002 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72001‎ | r72002 | r72003 >
Date:01:10, 31 August 2010
Author:reedy
Status:deferred
Tags:
Comment:
Implement limiting, no continue. Should be no "need" for it at this point? Trivial enough to add if deemed necessary
Modified paths:
  • /trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleAssessmentPilot/api/ApiListArticleAssessment.php
@@ -49,6 +49,9 @@
5050 }
5151 }
5252
 53+ $limit = $params['limit'] * 4; //4 "Ratings"
 54+ $this->addOption( 'LIMIT', $limit );
 55+
5356 $res = $this->select( __METHOD__ );
5457
5558 $ratings = array();
@@ -82,7 +85,13 @@
8386 $ratings[$pageId]['ratings'][] = $thisRow;
8487 }
8588
 89+ $count = 0;
8690 foreach ( $ratings as $rat ) {
 91+ if ( ++ $count > $limit ) {
 92+ //$this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->page_title ) );
 93+ break;
 94+ }
 95+
8796 $result->setIndexedTagName( $rat['ratings'], 'r' );
8897 $result->addValue( array( 'query', $this->getModuleName() ), null, $rat );
8998 }
@@ -95,6 +104,13 @@
96105 'pageid' => null,
97106 'revid' => null,
98107 'userrating' => false,
 108+ 'limit' => array(
 109+ ApiBase::PARAM_DFLT => 1,
 110+ ApiBase::PARAM_TYPE => 'limit',
 111+ ApiBase::PARAM_MIN => 1,
 112+ ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
 113+ ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
 114+ ),
99115 );
100116 }
101117
@@ -103,6 +119,7 @@
104120 'pageid' => 'Page ID to get assessments for',
105121 'revid' => 'Specific revision to get (used in conjunction with user param, otherwise ignored)',
106122 'userrating' => 'Whether to get the current users ratings for the specific rev/article',
 123+ 'limit' => 'Amount of pages to get the ratings for',
107124 );
108125 }
109126

Follow-up revisions

RevisionCommit summaryAuthorDate
r72004Followup r72002, only multiply "limit" for the sql,reedy01:21, 31 August 2010

Status & tagging log