r62986 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62985‎ | r62986 | r62987 >
Date:01:12, 26 February 2010
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
Added query construction stuff
Modified paths:
  • /trunk/extensions/Storyboard/api/ApiStoryboardStoriesFeed.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Storyboard/api/ApiStoryboardStoriesFeed.php
@@ -45,7 +45,24 @@
4646 // Get the requests parameters.
4747 $params = $this->extractRequestParams();
4848
 49+ $this->addTables( 'storyboard' );
 50+ $this->addFields( array(
 51+ 'story_author_name',
 52+ 'story_title',
 53+ 'story_text',
 54+ 'story_created'
 55+ ) );
 56+ $this->addWhere( array(
 57+ 'story_is_published' => 1
 58+ ) );
 59+ $this->addOption( 'LIMIT', $params['limit'] );
 60+ $this->addOption( 'ORDER BY', 'story_modified' );
4961
 62+ $stories = $this->select( __METHOD__ );
 63+
 64+ while ( $story = $stories->fetchObject() ) {
 65+ // TODO: figure out how to output the data so the storyboard can use it
 66+ }
5067 }
5168
5269 /**

Comments

#Comment by Catrope (talk | contribs)   14:23, 26 February 2010

If you're gonna run this query, I recommend you add an index on (story_is_published, story_modified) so it'll perform acceptably.

+		$this->addOption( 'ORDER BY', 'story_modified' );

Note that this will sort oldest stories first. To sort newest stories first, use 'story_modified DESC'

#Comment by Jeroen De Dauw (talk | contribs)   15:36, 26 February 2010

Thanks. Fixed in 63009.

Status & tagging log