r114732 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114731‎ | r114732 | r114733 >
Date:00:47, 5 April 2012
Author:kaldari
Status:deferred
Tags:
Comment:
adding support for offsets to ApiPageTriageList.php
Modified paths:
  • /trunk/extensions/PageTriage/api/ApiPageTriageList.php (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.models/ext.pageTriage.article.js (modified) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/modules/ext.pageTriage.models/ext.pageTriage.article.js
@@ -48,7 +48,6 @@
4949 apiParams: {
5050 namespace: 0,
5151 limit: 50,
52 - offset: 0,
5352 dir: 'oldestfirst',
5453 /*
5554 showbots: null,
Index: trunk/extensions/PageTriage/api/ApiPageTriageList.php
@@ -50,8 +50,10 @@
5151
5252 if ( strtolower( $opts['dir'] ) === 'oldestfirst' ) {
5353 $options['ORDER BY'] = 'ptrp_timestamp ASC';
 54+ $offsetOperator = ' > ';
5455 } else {
5556 $options['ORDER BY'] = 'ptrp_timestamp DESC';
 57+ $offsetOperator = ' < ';
5658 }
5759
5860 // Start building the massive filter which includes meta data
@@ -73,6 +75,10 @@
7476 if ( array_key_exists( 'namespace', $opts ) ) {
7577 $conds['page_namespace'] = $opts['namespace'];
7678 }
 79+ // Offset the list
 80+ if ( array_key_exists( 'offset', $opts ) && is_numeric( $opts['offset'] ) ) {
 81+ $conds[] = 'ptrp_timestamp' . $offsetOperator . $opts['offset'];
 82+ }
7783
7884 if ( $tagConds ) {
7985 $conds[] = '(' . implode( ' OR ', $tagConds ) . ') AND ptrpt_page_id = ptrp_page_id';
@@ -145,6 +151,9 @@
146152 ApiBase::PARAM_MIN => '10',
147153 ApiBase::PARAM_TYPE => 'integer',
148154 ),
 155+ 'offset' => array(
 156+ ApiBase::PARAM_TYPE => 'integer',
 157+ ),
149158 'dir' => array(
150159 ApiBase::PARAM_TYPE => 'string',
151160 ),
@@ -174,6 +183,7 @@
175184 'showredirs' => 'Whether to include redirects or not', // default is not to show redirects
176185 'showtriaged' => 'Whether to include triaged or not', // default is not to show triaged
177186 'limit' => 'The maximum number of results to return',
 187+ 'offset' => 'Timestamp to start from',
178188 'dir' => 'The direction the list should be sorted in - oldestfirst or newestfirst',
179189 'namespace' => 'What namespace to pull pages from',
180190 'no_category' => 'Whether to show only pages with no category',

Status & tagging log