* @param string $subpage
*/
public function execute( $subpage ) {
- global $wgStructuredChangeFiltersEnableSaving,
- $wgStructuredChangeFiltersEnableExperimentalViews;
-
// Backwards-compatibility: redirect to new feed URLs
$feedFormat = $this->getRequest()->getVal( 'feed' );
if ( !$this->including() && $feedFormat ) {
)
);
+ $experimentalStructuredChangeFilters =
+ $this->getConfig()->get( 'StructuredChangeFiltersEnableExperimentalViews' );
+
$out->addJsConfigVars( 'wgStructuredChangeFilters', $jsData['groups'] );
$out->addJsConfigVars(
'wgStructuredChangeFiltersEnableSaving',
- $wgStructuredChangeFiltersEnableSaving
+ $this->getConfig()->get( 'StructuredChangeFiltersEnableSaving' )
);
$out->addJsConfigVars(
'wgStructuredChangeFiltersEnableExperimentalViews',
- $wgStructuredChangeFiltersEnableExperimentalViews
+ $experimentalStructuredChangeFilters
);
$out->addJsConfigVars(
- 'wgRCFiltersChangeTags',
- $this->buildChangeTagList()
+ 'wgStructuredChangeFiltersEnableLiveUpdate',
+ $this->getConfig()->get( 'StructuredChangeFiltersEnableLiveUpdate' )
);
+ if ( $experimentalStructuredChangeFilters ) {
+ $out->addJsConfigVars(
+ 'wgRCFiltersChangeTags',
+ $this->buildChangeTagList()
+ );
+ }
}
}
* @return Array Tag data
*/
protected function buildChangeTagList() {
- function stripAllHtml( $input ) {
- return trim( html_entity_decode( strip_tags( $input ) ) );
- }
-
$explicitlyDefinedTags = array_fill_keys( ChangeTags::listExplicitlyDefinedTags(), 0 );
$softwareActivatedTags = array_fill_keys( ChangeTags::listSoftwareActivatedTags(), 0 );
- $tagStats = ChangeTags::tagUsageStatistics();
+ // Hit counts disabled for perf reasons, see T169997
+ /*
+ $tagStats = ChangeTags::tagUsageStatistics();
$tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags, $tagStats );
// Sort by hits
arsort( $tagHitCounts );
+ */
+ $tagHitCounts = array_merge( $explicitlyDefinedTags, $softwareActivatedTags );
// Build the list and data
$result = [];
$result[] = [
'name' => $tagName,
- 'label' => stripAllHtml( ChangeTags::tagDescription( $tagName, $this->getContext() ) ),
- 'description' => $desc ? stripAllHtml( $desc->parse() ) : '',
+ 'label' => Sanitizer::stripAllTags(
+ ChangeTags::tagDescription( $tagName, $this->getContext() )
+ ),
+ 'description' => $desc ? Sanitizer::stripAllTags( $desc->parse() ) : '',
'cssClass' => Sanitizer::escapeClass( 'mw-tag-' . $tagName ),
'hits' => $hits,
];
}
}
+ // Instead of sorting by hit count (disabled, see above), sort by display name
+ usort( $result, function ( $a, $b ) {
+ return strcasecmp( $a['label'], $b['label'] );
+ } );
+
return $result;
}
$opts = parent::getDefaultOptions();
$user = $this->getUser();
- $opts->add( 'days', $user->getIntOption( 'rcdays' ) );
+ $opts->add( 'days', $user->getIntOption( 'rcdays' ), FormOptions::FLOAT );
$opts->add( 'limit', $user->getIntOption( 'rclimit' ) );
$opts->add( 'from', '' );
if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) {
$opts['limit'] = $m[1];
}
- if ( preg_match( '/^days=(\d+)$/', $bit, $m ) ) {
+ if ( preg_match( '/^days=(\d+(?:\.\d+)?)$/', $bit, $m ) ) {
$opts['days'] = $m[1];
}
if ( preg_match( '/^namespace=(.*)$/', $bit, $m ) ) {
// Calculate cutoff
$cutoff_unixtime = time() - ( $opts['days'] * 86400 );
- $cutoff_unixtime = $cutoff_unixtime - ( $cutoff_unixtime % 86400 );
$cutoff = $dbr->timestamp( $cutoff_unixtime );
$fromValid = preg_match( '/^[0-9]{14}$/', $opts['from'] );
[ 'class' => 'rcfilters-container' ]
);
+ $loadingContainer = Html::rawElement(
+ 'div',
+ [ 'class' => 'rcfilters-spinner' ],
+ Html::element(
+ 'div',
+ [ 'class' => 'rcfilters-spinner-bounce' ]
+ )
+ );
+
// Wrap both with rcfilters-head
$this->getOutput()->addHTML(
Html::rawElement(
$rcfilterContainer . $rcoptions
)
);
+
+ // Add spinner
+ $this->getOutput()->addHTML( $loadingContainer );
} else {
$this->getOutput()->addHTML( $rcoptions );
}