+ $params = $this->extractRequestParams();
+
+ if( !$wgFeed ) {
+ $this->dieUsage( 'Syndication feeds are not available', 'feed-unavailable' );
+ }
+
+ if( !isset( $wgFeedClasses[ $params['feedformat'] ] ) ) {
+ $this->dieUsage( 'Invalid subscription feed type', 'feed-invalid' );
+ }
+ if ( !is_null( $params['wlexcludeuser'] ) ) {
+ $fauxReqArr['wlexcludeuser'] = $params['wlexcludeuser'];
+ }
+
+ // limit to the number of hours going from now back
+ $endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) );
+
+ // 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
+ 'wllimit' => ( 50 > $wgFeedLimit ) ? $wgFeedLimit : 50
+ );
+
+ if ( !is_null( $params['wlowner'] ) ) {
+ $fauxReqArr['wlowner'] = $params['wlowner'];
+ }
+ if ( !is_null( $params['wltoken'] ) ) {
+ $fauxReqArr['wltoken'] = $params['wltoken'];
+ }
+
+ // Support linking to diffs instead of article
+ if ( $params['linktodiffs'] ) {
+ $this->linkToDiffs = true;
+ $fauxReqArr['wlprop'] .= '|ids';
+ }
+
+ // Check for 'allrev' parameter, and if found, show all revisions to each page on wl.
+ if ( $params['allrev'] ) {
+ $fauxReqArr['wlallrev'] = '';
+ }
+
+ // Create the request
+ $fauxReq = new FauxRequest( $fauxReqArr );
+
+ // Execute
+ $module = new ApiMain( $fauxReq );