$opts->add( 'urlversion', 1 );
$opts->add( 'tagfilter', '' );
+ $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT );
+ $opts->add( 'limit', $this->getDefaultLimit(), FormOptions::INT );
+
+ $opts->add( 'from', '' );
+
return $opts;
}
$query = wfArrayToCgi( $this->convertParamsForLink( $opts->getChangedValues() ) );
$this->getOutput()->redirect( $this->getPageTitle()->getCanonicalURL( $query ) );
}
+
+ $opts->validateIntBounds( 'limit', 0, 5000 );
+ $opts->validateBounds( 'days', 0, $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
}
/**
}
$conds[] = "rc_namespace $operator $value";
}
+
+ // Calculate cutoff
+ $cutoff_unixtime = time() - $opts['days'] * 3600 * 24;
+ $cutoff = $dbr->timestamp( $cutoff_unixtime );
+
+ $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
+ if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
+ $cutoff = $dbr->timestamp( $opts['from'] );
+ } else {
+ $opts->reset( 'from' );
+ }
+
+ $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
}
/**
true
);
parent::execute( $subpage );
-
- if ( $this->isStructuredFilterUiEnabled() ) {
- $out->addJsConfigVars( 'wgStructuredChangeFiltersLiveUpdateSupported', true );
- }
}
/**
public function getDefaultOptions() {
$opts = parent::getDefaultOptions();
- $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT );
- $opts->add( 'limit', $this->getDefaultLimit() );
- $opts->add( 'from', '' );
-
$opts->add( 'categories', '' );
$opts->add( 'categories_any', false );
}
}
- public function validateOptions( FormOptions $opts ) {
- $opts->validateIntBounds( 'limit', 0, 5000 );
- $opts->validateBounds( 'days', 0, $this->getConfig()->get( 'RCMaxAge' ) / ( 3600 * 24 ) );
- parent::validateOptions( $opts );
- }
-
- /**
- * @inheritDoc
- */
- protected function buildQuery( &$tables, &$fields, &$conds,
- &$query_options, &$join_conds, FormOptions $opts
- ) {
- $dbr = $this->getDB();
- parent::buildQuery( $tables, $fields, $conds,
- $query_options, $join_conds, $opts );
-
- // Calculate cutoff
- $cutoff_unixtime = time() - $opts['days'] * 3600 * 24;
- $cutoff = $dbr->timestamp( $cutoff_unixtime );
-
- $fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
- if ( $fromValid && $opts['from'] > wfTimestamp( TS_MW, $cutoff ) ) {
- $cutoff = $dbr->timestamp( $opts['from'] );
- } else {
- $opts->reset( 'from' );
- }
-
- $conds[] = 'rc_timestamp >= ' . $dbr->addQuotes( $cutoff );
- }
-
/**
* @inheritDoc
*/
if ( $this->isStructuredFilterUiEnabled() ) {
$output->addModuleStyles( [ 'mediawiki.rcfilters.highlightCircles.seenunseen.styles' ] );
- $output->addJsConfigVars( 'wgStructuredChangeFiltersLiveUpdateSupported', false );
$output->addJsConfigVars(
'wgStructuredChangeFiltersEditWatchlistUrl',
SpecialPage::getTitleFor( 'EditWatchlist' )->getLocalURL()
}
}
- /**
- * Get a FormOptions object containing the default options
- *
- * @return FormOptions
- */
- public function getDefaultOptions() {
- $opts = parent::getDefaultOptions();
-
- $opts->add( 'days', $this->getDefaultDays(), FormOptions::FLOAT );
- $opts->add( 'limit', $this->getDefaultLimit(), FormOptions::INT );
-
- return $opts;
- }
-
- public function validateOptions( FormOptions $opts ) {
- $opts->validateBounds( 'days', 0, $this->maxDays );
- $opts->validateIntBounds( 'limit', 0, 5000 );
- parent::validateOptions( $opts );
- }
-
/**
* Get all custom filters
*
return $opts;
}
- /**
- * @inheritDoc
- */
- protected function buildQuery( &$tables, &$fields, &$conds, &$query_options,
- &$join_conds, FormOptions $opts
- ) {
- $dbr = $this->getDB();
- parent::buildQuery( $tables, $fields, $conds, $query_options, $join_conds,
- $opts );
-
- // Calculate cutoff
- if ( $opts['days'] > 0 ) {
- $conds[] = 'rc_timestamp > ' .
- $dbr->addQuotes( $dbr->timestamp( time() - $opts['days'] * 3600 * 24 ) );
- }
- }
-
/**
* @inheritDoc
*/
$timestamp = wfTimestampNow();
$wlInfo = Html::rawElement(
'span',
- [ 'class' => 'wlinfo' ],
+ [
+ 'class' => 'wlinfo',
+ 'data-params' => json_encode( [ 'from' => $timestamp ] ),
+ ],
$this->msg( 'wlnote' )->numParams( $numRows, round( $days * 24 ) )->params(
$lang->userDate( $timestamp, $user ), $lang->userTime( $timestamp, $user )
)->parse()
* @param {jQuery} $fieldset
*/
mw.rcfilters.dm.ChangesListViewModel.prototype.extractNextFrom = function ( $fieldset ) {
- var data = $fieldset.find( '.rclistfrom > a' ).data( 'params' );
+ var data = $fieldset.find( '.rclistfrom > a, .wlinfo' ).data( 'params' );
this.nextFrom = data ? data.from : null;
};