public function validateOptions( FormOptions $opts ) {
$opts->validateIntBounds( 'limit', 0, 5000 );
+ $opts->validateBounds( 'days', 0, $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
parent::validateOptions( $opts );
}
$query_options, $join_conds, $opts );
// Calculate cutoff
- $cutoff_unixtime = time() - ( $opts['days'] * 86400 );
+ $cutoff_unixtime = time() - $opts['days'] * 3600 * 24;
$cutoff = $dbr->timestamp( $cutoff_unixtime );
$fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
class SpecialWatchlist extends ChangesListSpecialPage {
public function __construct( $page = 'Watchlist', $restriction = 'viewmywatchlist' ) {
parent::__construct( $page, $restriction );
+
+ $this->maxDays = $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 );
}
public function doesWrites() {
return $opts;
}
+ public function validateOptions( FormOptions $opts ) {
+ $opts->validateBounds( 'days', 0, $this->maxDays );
+ parent::validateOptions( $opts );
+ }
+
/**
* Get all custom filters
*
// Calculate cutoff
if ( $opts['days'] > 0 ) {
$conds[] = 'rc_timestamp > ' .
- $dbr->addQuotes( $dbr->timestamp( time() - intval( $opts['days'] * 86400 ) ) );
+ $dbr->addQuotes( $dbr->timestamp( time() - $opts['days'] * 3600 * 24 ) );
}
}
if ( $opts['days'] > 0 ) {
$days = $opts['days'];
} else {
- $days = $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 );
+ $days = $this->maxDays;
}
$timestamp = wfTimestampNow();
$wlInfo = $this->msg( 'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
$days[] = $userWatchlistOption;
}
- $maxDays = (string)( $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
+ $maxDays = (string)$this->maxDays;
// add the maximum possible value, if it isn't available already
if ( !in_array( $maxDays, $days ) ) {
$days[] = $maxDays;