* @ingroup SpecialPage
*/
class SpecialWatchlist extends ChangesListSpecialPage {
- /**
- * Constructor
- */
public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
parent::__construct( $page, $restriction );
}
if ( $mode !== false ) {
if ( $mode === SpecialEditWatchlist::EDIT_RAW ) {
$title = SpecialPage::getTitleFor( 'EditWatchlist', 'raw' );
+ } elseif ( $mode === SpecialEditWatchlist::EDIT_CLEAR ) {
+ $title = SpecialPage::getTitleFor( 'EditWatchlist', 'clear' );
} else {
$title = SpecialPage::getTitleFor( 'EditWatchlist' );
}
$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;
}
*/
protected function getCustomFilters() {
if ( $this->customFilters === null ) {
- $this->customFilters = array();
- wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ) );
+ $this->customFilters = parent::getCustomFilters();
+ wfRunHooks( 'SpecialWatchlistFilters', array( $this, &$this->customFilters ), '1.23' );
}
return $this->customFilters;
* Maps old pre-1.23 request parameters Watchlist used to use (different from Recentchanges' ones)
* to the current ones.
*
- * @param FormOptions $parameters
+ * @param FormOptions $opts
* @return FormOptions
*/
protected function fetchOptionsFromRequest( $opts ) {
// 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;
);
wfRunHooks( 'SpecialWatchlistQuery',
- array( &$conds, &$tables, &$join_conds, &$fields, $opts ) );
+ array( &$conds, &$tables, &$join_conds, &$fields, $opts ),
+ '1.23' );
return $dbr->select(
$tables,
$list = ChangesList::newFromContext( $this->getContext() );
$list->setWatchlistDivs();
+ $list->initChangesListRows( $rows );
+ $dbr->dataSeek( $rows, 0 );
$s = $list->beginRecentChangesList();
$counter = 1;
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 ),
* Count the number of items on a user's watchlist
*
* @param DatabaseBase $dbr A database connection
- * @return Integer
+ * @return int
*/
protected function countItems( $dbr ) {
# Fetch the raw count