* @return bool|ResultWrapper Result or false (for Recentchangeslinked only)
*/
public function doMainQuery( $conds, $opts ) {
- global $wgAllowCategorizedRecentChanges;
-
$dbr = $this->getDB();
$user = $this->getUser();
$opts['tagfilter']
);
- if ( !wfRunHooks( 'SpecialRecentChangesQuery',
- array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ),
- '1.23' )
+ if ( !$this->runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds,
+ $opts )
) {
return false;
}
);
// Build the final data
- if ( $wgAllowCategorizedRecentChanges ) {
+ if ( $this->getConfig()->get( 'AllowCategorizedRecentChanges' ) ) {
$this->filterByCategories( $rows, $opts );
}
return $rows;
}
+ protected function runMainQueryHook( &$tables, &$fields, &$conds, &$query_options, &$join_conds, $opts ) {
+ return parent::runMainQueryHook( $tables, $fields, $conds, $query_options, $join_conds, $opts )
+ && wfRunHooks(
+ 'SpecialRecentChangesQuery',
+ array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$fields ),
+ '1.23'
+ );
+ }
+
public function outputFeedLinks() {
$this->addFeedLinks( $this->getFeedQuery() );
}
* @return array
*/
private function getFeedQuery() {
- global $wgFeedLimit;
$query = array_filter( $this->getOptions()->getAllValues(), function ( $value ) {
// API handles empty parameters in a different way
return $value !== '';
} );
$query['action'] = 'feedrecentchanges';
- if ( $query['limit'] > $wgFeedLimit ) {
- $query['limit'] = $wgFeedLimit;
+ $feedLimit = $this->getConfig()->get( 'FeedLimit' );
+ if ( $query['limit'] > $feedLimit ) {
+ $query['limit'] = $feedLimit;
}
return $query;
* @param FormOptions $opts
*/
public function outputChangesList( $rows, $opts ) {
- global $wgRCShowWatchingUsers, $wgShowUpdatedMarker;
-
$limit = $opts['limit'];
- $showWatcherCount = $wgRCShowWatchingUsers
+ $showWatcherCount = $this->getConfig()->get( 'RCShowWatchingUsers' )
&& $this->getUser()->getOption( 'shownumberswatching' );
$watcherCache = array();
$rc = RecentChange::newFromRow( $obj );
$rc->counter = $counter++;
# Check if the page has been updated since the last visit
- if ( $wgShowUpdatedMarker && !empty( $obj->wl_notificationtimestamp ) ) {
+ if ( $this->getConfig()->get( 'ShowUpdatedMarker' ) && !empty( $obj->wl_notificationtimestamp ) ) {
$rc->notificationtimestamp = ( $obj->rc_timestamp >= $obj->wl_notificationtimestamp );
} else {
$rc->notificationtimestamp = false; // Default
$this->msg( 'recentchanges-noresult' )->parse() .
'</div>'
);
+ if ( !$this->including() ) {
+ $this->getOutput()->setStatusCode( 404 );
+ }
} else {
$this->getOutput()->addHTML( $rclistOutput );
}
* Set the text to be displayed above the changes
*
* @param FormOptions $opts
+ * @param int $numRows Number of rows in the result to show after this header
*/
- public function doHeader( $opts ) {
- global $wgScript;
-
+ public function doHeader( $opts, $numRows ) {
$this->setTopText( $opts );
$defaults = $opts->getAllValues();
$panel = array();
$panel[] = self::makeLegend( $this->getContext() );
- $panel[] = $this->optionsPanel( $defaults, $nondefaults );
+ $panel[] = $this->optionsPanel( $defaults, $nondefaults, $numRows );
$panel[] = '<hr />';
$extraOpts = $this->getExtraOptions( $opts );
$t = $this->getPageTitle();
$out .= Html::hidden( 'title', $t->getPrefixedText() );
- $form = Xml::tags( 'form', array( 'action' => $wgScript ), $out );
+ $form = Xml::tags( 'form', array( 'action' => wfScript() ), $out );
$panel[] = $form;
$panelString = implode( "\n", $panel );
$extraOpts = array();
$extraOpts['namespace'] = $this->namespaceFilterForm( $opts );
- global $wgAllowCategorizedRecentChanges;
- if ( $wgAllowCategorizedRecentChanges ) {
+ if ( $this->getConfig()->get( 'AllowCategorizedRecentChanges' ) ) {
$extraOpts['category'] = $this->categoryFilterForm( $opts );
}
}
# Look up
- $c = new Categoryfinder;
- $c->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
- $match = $c->run();
+ $catFind = new CategoryFinder;
+ $catFind->seed( $articles, $cats, $opts['categories_any'] ? 'OR' : 'AND' );
+ $match = $catFind->run();
# Filter
$newrows = array();
*
* @param array $defaults
* @param array $nondefaults
+ * @param int $numRows Number of rows in the result to show after this header
* @return string
*/
- function optionsPanel( $defaults, $nondefaults ) {
- global $wgRCLinkLimits, $wgRCLinkDays;
-
+ function optionsPanel( $defaults, $nondefaults, $numRows ) {
$options = $nondefaults + $defaults;
$note = '';
$lang = $this->getLanguage();
$user = $this->getUser();
if ( $options['from'] ) {
- $note .= $this->msg( 'rcnotefrom' )->numParams( $options['limit'] )->params(
- $lang->userTimeAndDate( $options['from'], $user ),
- $lang->userDate( $options['from'], $user ),
- $lang->userTime( $options['from'], $user ) )->parse() . '<br />';
+ $note .= $this->msg( 'rcnotefrom' )
+ ->numParams( $options['limit'] )
+ ->params(
+ $lang->userTimeAndDate( $options['from'], $user ),
+ $lang->userDate( $options['from'], $user ),
+ $lang->userTime( $options['from'], $user )
+ )
+ ->numParams( $numRows )
+ ->parse() . '<br />';
}
# Sort data for display and make sure it's unique after we've added user data.
- $linkLimits = $wgRCLinkLimits;
+ $linkLimits = $this->getConfig()->get( 'RCLinkLimits' );
$linkLimits[] = $options['limit'];
sort( $linkLimits );
$linkLimits = array_unique( $linkLimits );
- $linkDays = $wgRCLinkDays;
+ $linkDays = $this->getConfig()->get( 'RCLinkDays' );
$linkDays[] = $options['days'];
sort( $linkDays );
$linkDays = array_unique( $linkDays );