r64270 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64269‎ | r64270 | r64271 >
Date:19:58, 27 March 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Small fix + attempt to get the limit param implemented
Modified paths:
  • /trunk/extensions/Storyboard/api/ApiQueryStories.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/api/ApiQueryStories.php
@@ -61,8 +61,15 @@
6262 $this->addOption( 'ORDER BY', 'story_modified DESC' );
6363
6464 $stories = $this->select( __METHOD__ );
 65+ $count = 0;
6566
6667 while ( $story = $stories->fetchObject() ) {
 68+ if ( ++$count > $params['limit'] ) {
 69+ // We've reached the one extra which shows that
 70+ // there are additional pages to be had. Stop here...
 71+ $this->setContinueEnumParameter( 'continue', "" ); // TODO: add some weird stuff here
 72+ break;
 73+ }
6774 $res = array(
6875 'id' => $story->story_id,
6976 'author' => $story->story_author_name,
@@ -99,8 +106,8 @@
100107 */
101108 public function getParamDescription() {
102109 return array (
103 - 'offset' => 'Number of the first story to return',
104 - 'size' => 'Amount of stories to return',
 110+ 'continue' => 'Number of the first story to return',
 111+ 'limit' => 'Amount of stories to return',
105112 );
106113 }
107114

Status & tagging log