summaryrefslogtreecommitdiff
path: root/includes/api/ApiFeedWatchlist.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api/ApiFeedWatchlist.php')
-rw-r--r--includes/api/ApiFeedWatchlist.php29
1 files changed, 19 insertions, 10 deletions
diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php
index b2f6ceff..9b17b9d3 100644
--- a/includes/api/ApiFeedWatchlist.php
+++ b/includes/api/ApiFeedWatchlist.php
@@ -62,17 +62,24 @@ class ApiFeedWatchlist extends ApiBase {
// limit to the number of hours going from now back
$endTime = wfTimestamp(TS_MW, time() - intval($params['hours'] * 60 * 60));
- // Prepare nested request
- $fauxReq = new FauxRequest(array (
+ $dbr = wfGetDB( DB_SLAVE );
+ // Prepare parameters for nested request
+ $fauxReqArr = array (
'action' => 'query',
'meta' => 'siteinfo',
'siprop' => 'general',
'list' => 'watchlist',
'wlprop' => 'title|user|comment|timestamp',
'wldir' => 'older', // reverse order - from newest to oldest
- 'wlend' => $endTime, // stop at this time
+ 'wlend' => $dbr->timestamp($endTime), // stop at this time
'wllimit' => 50
- ));
+ );
+
+ // Check for 'allrev' parameter, and if found, show all revisions to each page on wl.
+ if ( ! is_null ( $params['allrev'] ) ) $fauxReqArr['wlallrev'] = '';
+
+ // Create the request
+ $fauxReq = new FauxRequest ( $fauxReqArr );
// Execute
$module = new ApiMain($fauxReq);
@@ -131,7 +138,7 @@ class ApiFeedWatchlist extends ApiBase {
return new FeedItem($titleStr, $completeText, $titleUrl, $timestamp, $user);
}
- protected function getAllowedParams() {
+ public function getAllowedParams() {
global $wgFeedClasses;
$feedFormatNames = array_keys($wgFeedClasses);
return array (
@@ -144,18 +151,20 @@ class ApiFeedWatchlist extends ApiBase {
ApiBase :: PARAM_TYPE => 'integer',
ApiBase :: PARAM_MIN => 1,
ApiBase :: PARAM_MAX => 72,
- )
+ ),
+ 'allrev' => null
);
}
- protected function getParamDescription() {
+ public function getParamDescription() {
return array (
'feedformat' => 'The format of the feed',
- 'hours' => 'List pages modified within this many hours from now'
+ 'hours' => 'List pages modified within this many hours from now',
+ 'allrev' => 'Include multiple revisions of the same page within given timeframe.'
);
}
- protected function getDescription() {
+ public function getDescription() {
return 'This module returns a watchlist feed';
}
@@ -166,7 +175,7 @@ class ApiFeedWatchlist extends ApiBase {
}
public function getVersion() {
- return __CLASS__ . ': $Id: ApiFeedWatchlist.php 23531 2007-06-29 01:19:14Z simetrical $';
+ return __CLASS__ . ': $Id: ApiFeedWatchlist.php 30222 2008-01-28 19:05:26Z catrope $';
}
}