* (T27187) Search suggestions based on jquery.suggestions will now correctly only
highlight prefix matches in the results.
* (T157035) "new mw.Uri()" was ignoring options when using default URI.
+* Special:Allpages can no longer be filtered by redirect in miser mode.
=== Action API changes in 1.29 ===
* Submitting sensitive authentication request parameters to action=login,
* action=purge now requires a POST.
* There is a new `languagevariants` siprop for action=query&meta=siteinfo,
which returns a list of languages with active LanguageConverter instances.
+* action=query&query=allpages will no longer filter redirects using a database
+ query in miser mode. This may result in less results being returned than were
+ requested.
=== Action API internal changes in 1.29 ===
* New methods were added to ApiBase to handle errors and warnings using i18n
$this->addWhere( "page_title $op= $cont_from" );
}
- if ( $params['filterredir'] == 'redirects' ) {
- $this->addWhereFld( 'page_is_redirect', 1 );
- } elseif ( $params['filterredir'] == 'nonredirects' ) {
- $this->addWhereFld( 'page_is_redirect', 0 );
+ $miserMode = $this->getConfig()->get( 'MiserMode' );
+ if ( !$miserMode ) {
+ if ( $params['filterredir'] == 'redirects' ) {
+ $this->addWhereFld( 'page_is_redirect', 1 );
+ } elseif ( $params['filterredir'] == 'nonredirects' ) {
+ $this->addWhereFld( 'page_is_redirect', 0 );
+ }
}
$this->addWhereFld( 'page_namespace', $params['namespace'] );
$selectFields = $resultPageSet->getPageTableFields();
}
+ $miserModeFilterRedirValue = null;
+ $miserModeFilterRedir = $miserMode && $params['filterredir'] !== 'all';
+ if ( $miserModeFilterRedir ) {
+ $selectFields[] = 'page_is_redirect';
+
+ if ( $params['filterredir'] == 'redirects' ) {
+ $miserModeFilterRedirValue = 1;
+ } elseif ( $params['filterredir'] == 'nonredirects' ) {
+ $miserModeFilterRedirValue = 0;
+ }
+ }
+
$this->addFields( $selectFields );
$forceNameTitleIndex = true;
if ( isset( $params['minsize'] ) ) {
break;
}
+ if ( $miserModeFilterRedir && (int)$row->page_is_redirect !== $miserModeFilterRedirValue ) {
+ // Filter implemented in PHP due to being in Miser Mode
+ continue;
+ }
+
if ( is_null( $resultPageSet ) ) {
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
$vals = [
}
public function getAllowedParams() {
- return [
+ $ret = [
'from' => null,
'continue' => [
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
ApiBase::PARAM_DFLT => 'all'
],
];
+
+ if ( $this->getConfig()->get( 'MiserMode' ) ) {
+ $ret['filterredir'][ApiBase::PARAM_HELP_MSG_APPEND] = [ 'api-help-param-limited-in-miser-mode' ];
+ }
+
+ return $ret;
}
protected function getExamplesMessages() {
* to the order in which the handles where given.
*
* @param FileBackendStoreOpHandle[] $fileOpHandles
- *
- * @throws FileBackendError
* @return StatusValue[] Map of StatusValue objects
+ * @throws FileBackendError
*/
final public function executeOpHandlesInternal( array $fileOpHandles ) {
$ps = $this->scopedProfileSection( __METHOD__ . "-{$this->name}" );
foreach ( $fileOpHandles as $fileOpHandle ) {
if ( !( $fileOpHandle instanceof FileBackendStoreOpHandle ) ) {
- throw new InvalidArgumentException( "Got a non-FileBackendStoreOpHandle object." );
+ throw new InvalidArgumentException( "Expected FileBackendStoreOpHandle object." );
} elseif ( $fileOpHandle->backend->getName() !== $this->getName() ) {
- throw new InvalidArgumentException(
- "Got a FileBackendStoreOpHandle for the wrong backend." );
+ throw new InvalidArgumentException( "Expected handle for this file backend." );
}
}
+
$res = $this->doExecuteOpHandlesInternal( $fileOpHandles );
foreach ( $fileOpHandles as $fileOpHandle ) {
$fileOpHandle->closeResources();
if ( !empty( $params['async'] ) ) { // deferred
$status->value = $opHandle;
} else { // actually write the object in Swift
- $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) );
+ $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) );
}
return $status;
if ( !empty( $params['async'] ) ) { // deferred
$status->value = $opHandle;
} else { // actually write the object in Swift
- $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) );
+ $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) );
}
return $status;
if ( !empty( $params['async'] ) ) { // deferred
$status->value = $opHandle;
} else { // actually write the object in Swift
- $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) );
+ $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) );
}
return $status;
if ( !empty( $params['async'] ) ) { // deferred
$status->value = $opHandle;
} else { // actually move the object in Swift
- $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) );
+ $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) );
}
return $status;
if ( !empty( $params['async'] ) ) { // deferred
$status->value = $opHandle;
} else { // actually delete the object in Swift
- $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) );
+ $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) );
}
return $status;
if ( !empty( $params['async'] ) ) { // deferred
$status->value = $opHandle;
} else { // actually change the object in Swift
- $status->merge( current( $this->doExecuteOpHandlesInternal( [ $opHandle ] ) ) );
+ $status->merge( current( $this->executeOpHandlesInternal( [ $opHandle ] ) ) );
}
return $status;
$from = $request->getVal( 'from', null );
$to = $request->getVal( 'to', null );
$namespace = $request->getInt( 'namespace' );
- $hideredirects = $request->getBool( 'hideredirects', false );
+
+ $miserMode = (bool)$this->getConfig()->get( 'MiserMode' );
+
+ // Redirects filter is disabled in MiserMode
+ $hideredirects = $request->getBool( 'hideredirects', false ) && !$miserMode;
$namespaces = $this->getLanguage()->getNamespaces();
protected function outputHTMLForm( $namespace = NS_MAIN,
$from = '', $to = '', $hideRedirects = false
) {
+ $miserMode = (bool)$this->getConfig()->get( 'MiserMode' );
$fields = [
'from' => [
'type' => 'text',
'value' => $hideRedirects,
],
];
+
+ if ( $miserMode ) {
+ unset ( $fields['hideredirects'] );
+ }
+
$form = HTMLForm::factory( 'table', $fields, $this->getContext() );
$form->setMethod( 'get' )
->setWrapperLegendMsg( 'allpages' )
"page_first": "first",
"page_last": "last",
"histlegend": "Diff selection: Mark the radio boxes of the revisions to compare and hit enter or the button at the bottom.<br />\nLegend: <strong>({{int:cur}})</strong> = difference with latest revision, <strong>({{int:last}})</strong> = difference with preceding revision, <strong>{{int:minoreditletter}}</strong> = minor edit.",
- "history-fieldset-title": "Browse history",
+ "history-fieldset-title": "Search for revisions",
"history-show-deleted": "Revision deleted only",
"history_copyright": "-",
"histfirst": "oldest",
"recentchanges-legend": "Recent changes options",
"recentchanges-summary": "Track the most recent changes to the wiki on this page.",
"recentchangestext": "-",
- "recentchanges-noresult": "No changes during the given period matching these criteria.",
+ "recentchanges-noresult": "No changes during the given period match these criteria.",
"recentchanges-feed-description": "Track the most recent changes to the wiki in this feed.",
"recentchanges-label-newpage": "This edit created a new page",
"recentchanges-label-minor": "This is a minor edit",
'mediawiki.api',
'jquery.byteLimit',
// TitleOptionWidget
- 'jquery.autoEllipsis',
+ 'jquery.highlightText',
],
'messages' => [
// NamespaceInputWidget
* Empty all selected filters
*/
mw.rcfilters.Controller.prototype.emptyFilters = function () {
+ var highlightedFilterNames = this.filtersModel
+ .getHighlightedItems()
+ .map( function ( filterItem ) { return { name: filterItem.getName() }; } );
+
this.filtersModel.emptyAllFilters();
this.filtersModel.clearAllHighlightColors();
// Check all filter interactions
this.filtersModel.reassessFilterInteractions();
this.updateChangesList();
+
+ if ( highlightedFilterNames ) {
+ this.trackHighlight( 'clearAll', highlightedFilterNames );
+ }
};
/**
mw.rcfilters.Controller.prototype.setHighlightColor = function ( filterName, color ) {
this.filtersModel.setHighlightColor( filterName, color );
this.updateURL();
+ this.trackHighlight( 'set', { name: filterName, color: color } );
};
/**
mw.rcfilters.Controller.prototype.clearHighlightColor = function ( filterName ) {
this.filtersModel.clearHighlightColor( filterName );
this.updateURL();
+ this.trackHighlight( 'clear', filterName );
};
/**
* @param {string} filterName Name of the filter item
*/
mw.rcfilters.Controller.prototype.clearFilter = function ( filterName ) {
- var filterItem = this.filtersModel.getItemByName( filterName );
+ var filterItem = this.filtersModel.getItemByName( filterName ),
+ isHighlighted = filterItem.isHighlighted();
- if ( filterItem.isSelected() || filterItem.isHighlighted() ) {
+ if ( filterItem.isSelected() || isHighlighted ) {
this.filtersModel.clearHighlightColor( filterName );
this.filtersModel.toggleFilterSelected( filterName, false );
this.updateChangesList();
this.filtersModel.reassessFilterInteractions( filterItem );
}
+
+ if ( isHighlighted ) {
+ this.trackHighlight( 'clear', filterName );
+ }
};
/**
this.getUpdatedUri().toString()
);
};
+
+ /**
+ * Track usage of highlight feature
+ *
+ * @param {string} action
+ * @param {array|object|string} filters
+ */
+ mw.rcfilters.Controller.prototype.trackHighlight = function ( action, filters ) {
+ filters = $.type( filters ) === 'string' ? { name: filters } : filters;
+ filters = $.type( filters ) === 'object' ? [ filters ] : filters;
+ mw.track(
+ 'event.ChangesListHighlights',
+ {
+ action: action,
+ filters: filters
+ }
+ );
+ };
}( mediaWiki, jQuery ) );
}
} else {
this.scrollToTop( this.capsule.$element, 10 );
+ if ( !this.filterPopup.getSelectedFilter() ) {
+ // No selection, scroll the popup list to top
+ setTimeout( function () { this.capsule.popup.$body.scrollTop( 0 ); }.bind( this ), 0 );
+ }
}
};
} );
// Highlight matching parts of link suggestion
- this.$label.autoEllipsis( { hasSpan: false, tooltip: true, matchText: config.query } );
+ this.$label
+ .highlightText( config.query )
+ .attr( 'title', config.data );
if ( config.missing ) {
this.$label.addClass( 'new' );