* @ingroup SpecialPage
*/
class SpecialWatchlist extends ChangesListSpecialPage {
- /**
- * Constructor
- */
public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
parent::__construct( $page, $restriction );
}
}
$output->redirect( $title->getLocalURL() );
+
return;
}
$user = $this->getUser();
$opts = $this->getOptions();
- if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker ) && $request->getVal( 'reset' ) &&
- $request->wasPosted() )
- {
+ if ( ( $wgEnotifWatchlist || $wgShowUpdatedMarker )
+ && $request->getVal( 'reset' )
+ && $request->wasPosted()
+ ) {
$user->clearAllNotifications();
$output->redirect( $this->getPageTitle()->getFullURL( $opts->getChangedValues() ) );
+
return;
}
// methods defined on WebRequest and removing this dependency would cause some code duplication.
$request = new DerivativeRequest( $this->getRequest(), $params );
$opts->fetchValuesFromRequest( $request );
+
return $opts;
}
// Calculate cutoff
if ( $opts['days'] > 0 ) {
- $conds[] = 'rc_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( time() - intval( $opts['days'] * 86400 ) ) );
+ $conds[] = 'rc_timestamp > ' .
+ $dbr->addQuotes( $dbr->timestamp( time() - intval( $opts['days'] * 86400 ) ) );
}
return $conds;
$dbr = $this->getDB();
$user = $this->getUser();
+
# Toggle watchlist content (all recent edits or just the latest)
if ( $opts['extended'] ) {
$limitWatchlist = $user->getIntOption( 'wllimit' );
$tables = array( 'recentchanges', 'watchlist' );
$fields = RecentChange::selectFields();
+ $query_options = array( 'ORDER BY' => 'rc_timestamp DESC' );
$join_conds = array(
'watchlist' => array(
'INNER JOIN',
),
),
);
- $options = array( 'ORDER BY' => 'rc_timestamp DESC' );
+
if ( $wgShowUpdatedMarker ) {
$fields[] = 'wl_notificationtimestamp';
}
if ( $limitWatchlist ) {
- $options['LIMIT'] = $limitWatchlist;
+ $query_options['LIMIT'] = $limitWatchlist;
}
$rollbacker = $user->isAllowed( 'rollback' );
), LIST_OR );
}
+ ChangeTags::modifyDisplayQuery(
+ $tables,
+ $fields,
+ $conds,
+ $join_conds,
+ $query_options,
+ ''
+ );
- ChangeTags::modifyDisplayQuery( $tables, $fields, $conds, $join_conds, $options, '' );
- wfRunHooks( 'SpecialWatchlistQuery', array( &$conds, &$tables, &$join_conds, &$fields, $opts ) );
+ wfRunHooks( 'SpecialWatchlistQuery',
+ array( &$conds, &$tables, &$join_conds, &$fields, $opts ) );
- return $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds );
+ return $dbr->select(
+ $tables,
+ $fields,
+ $conds,
+ __METHOD__,
+ $query_options,
+ $join_conds
+ );
}
/**
}
/**
- * Send output to the OutputPage object, only called if not used feeds
+ * Output feed links.
+ */
+ public function outputFeedLinks() {
+ $user = $this->getUser();
+ $wlToken = $user->getTokenFromOption( 'watchlisttoken' );
+ if ( $wlToken ) {
+ $this->addFeedLinks( array(
+ 'action' => 'feedwatchlist',
+ 'allrev' => 1,
+ 'wlowner' => $user->getName(),
+ 'wltoken' => $wlToken,
+ ) );
+ }
+ }
+
+ /**
+ * Build and output the actual changes list.
*
* @param ResultWrapper $rows Database rows
* @param FormOptions $opts
*/
- public function webOutput( $rows, $opts ) {
+ public function outputChangesList( $rows, $opts ) {
global $wgShowUpdatedMarker, $wgRCShowWatchingUsers;
$dbr = $this->getDB();
$user = $this->getUser();
+ $output = $this->getOutput();
+
+ # Show a message about slave lag, if applicable
+ $lag = wfGetLB()->safeGetLag( $dbr );
+ if ( $lag > 0 ) {
+ $output->showLagWarning( $lag );
+ }
$dbr->dataSeek( $rows, 0 );
}
$s .= $list->endRecentChangesList();
- // Print things out
-
- $output = $this->getOutput();
-
- $output->addSubtitle(
- $this->msg( 'watchlistfor2', $user->getName() )
- ->rawParams( SpecialEditWatchlist::buildTools( null ) )
- );
-
- // Output options box
- $this->doHeader( $opts );
-
- // Add feed links
- $wlToken = $user->getTokenFromOption( 'watchlisttoken' );
- if ( $wlToken ) {
- $this->addFeedLinks( array(
- 'action' => 'feedwatchlist',
- 'allrev' => 1,
- 'wlowner' => $user->getName(),
- 'wltoken' => $wlToken,
- ) );
- }
-
- # Show a message about slave lag, if applicable
- $lag = wfGetLB()->safeGetLag( $dbr );
- if ( $lag > 0 ) {
- $output->showLagWarning( $lag );
- }
-
if ( $rows->numRows() == 0 ) {
$output->wrapWikiMsg(
"<div class='mw-changeslist-empty'>\n$1\n</div>", 'recentchanges-noresult'
public function doHeader( $opts ) {
$user = $this->getUser();
+ $this->getOutput()->addSubtitle(
+ $this->msg( 'watchlistfor2', $user->getName() )
+ ->rawParams( SpecialEditWatchlist::buildTools( null ) )
+ );
+
$this->setTopText( $opts );
$lang = $this->getLanguage();
if ( $opts['days'] > 0 ) {
$timestamp = wfTimestampNow();
$wlInfo = $this->msg( 'wlnote2' )->numParams( round( $opts['days'] * 24 ) )->params(
- $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user ) )->parse() . "<br />\n";
+ $lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
+ )->parse() . "<br />\n";
}
$nondefaults = $opts->getChangedValues();
$label = $this->msg( $value ? 'show' : 'hide' )->escaped();
$options[$name] = 1 - (int)$value;
- return $this->msg( $message )->rawParams( Linker::linkKnown( $this->getPageTitle(), $label, array(), $options ) )->escaped();
+ return $this->msg( $message )
+ ->rawParams( Linker::linkKnown( $this->getPageTitle(), $label, array(), $options ) )
+ ->escaped();
}
protected function hoursLink( $h, $options = array() ) {
protected function daysLink( $d, $options = array() ) {
$options['days'] = $d;
- $message = ( $d ? $this->getLanguage()->formatNum( $d ) : $this->msg( 'watchlistall2' )->escaped() );
+ $message = $d ? $this->getLanguage()->formatNum( $d )
+ : $this->msg( 'watchlistall2' )->escaped();
return Linker::linkKnown(
$this->getPageTitle(),
foreach ( $days as $d ) {
$days[$i++] = $this->daysLink( $d, $options );
}
+
return $this->msg( 'wlshowlast' )->rawParams(
$this->getLanguage()->pipeList( $hours ),
$this->getLanguage()->pipeList( $days ),