Merge "mediawiki.widgets: Remove autoEllipsis() from TitleOptionWidget"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 20 Mar 2017 21:35:43 +0000 (21:35 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 20 Mar 2017 21:35:43 +0000 (21:35 +0000)
RELEASE-NOTES-1.29
includes/api/ApiQueryAllPages.php
includes/libs/filebackend/FileBackendStore.php
includes/libs/filebackend/SwiftFileBackend.php
includes/specials/SpecialAllPages.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterCapsuleMultiselectWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterWrapperWidget.js

index 0c483e9..b9a93f1 100644 (file)
@@ -80,6 +80,7 @@ production.
 * (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,
@@ -114,6 +115,9 @@ production.
 * 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
index 7460bd5..6b959ae 100644 (file)
@@ -76,10 +76,13 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                        $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'] );
@@ -108,6 +111,18 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                        $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'] ) ) {
@@ -219,6 +234,11 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                                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 = [
@@ -242,7 +262,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
        }
 
        public function getAllowedParams() {
-               return [
+               $ret = [
                        'from' => null,
                        'continue' => [
                                ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
@@ -314,6 +334,12 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                                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() {
index 7cb26c6..039bd42 100644 (file)
@@ -1200,21 +1200,20 @@ abstract class FileBackendStore extends FileBackend {
         * 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();
index 631f6fd..ae0ad6f 100644 (file)
@@ -287,7 +287,7 @@ class SwiftFileBackend extends FileBackendStore {
                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;
@@ -353,7 +353,7 @@ class SwiftFileBackend extends FileBackendStore {
                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;
@@ -401,7 +401,7 @@ class SwiftFileBackend extends FileBackendStore {
                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;
@@ -460,7 +460,7 @@ class SwiftFileBackend extends FileBackendStore {
                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;
@@ -500,7 +500,7 @@ class SwiftFileBackend extends FileBackendStore {
                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;
@@ -556,7 +556,7 @@ class SwiftFileBackend extends FileBackendStore {
                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;
index 4b8446a..fd7bc3f 100644 (file)
@@ -69,7 +69,11 @@ class SpecialAllPages extends IncludableSpecialPage {
                $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();
 
@@ -100,6 +104,7 @@ class SpecialAllPages extends IncludableSpecialPage {
        protected function outputHTMLForm( $namespace = NS_MAIN,
                $from = '', $to = '', $hideRedirects = false
        ) {
+               $miserMode = (bool)$this->getConfig()->get( 'MiserMode' );
                $fields = [
                        'from' => [
                                'type' => 'text',
@@ -133,6 +138,11 @@ class SpecialAllPages extends IncludableSpecialPage {
                                'value' => $hideRedirects,
                        ],
                ];
+
+               if ( $miserMode ) {
+                       unset ( $fields['hideredirects'] );
+               }
+
                $form = HTMLForm::factory( 'table', $fields, $this->getContext() );
                $form->setMethod( 'get' )
                        ->setWrapperLegendMsg( 'allpages' )
index ccfa91b..f512000 100644 (file)
        "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",
        "rcfilters-activefilters": "Active filters",
        "rcfilters-restore-default-filters": "Restore default filters",
        "rcfilters-clear-all-filters": "Clear all filters",
+       "rcfilters-clear-filters-to-defaults": "Set filters to defaults",
        "rcfilters-search-placeholder": "Filter recent changes (browse or start typing)",
        "rcfilters-invalid-filter": "Invalid filter",
        "rcfilters-empty-filter": "No active filters. All contributions are shown.",
index f123189..3116163 100644 (file)
        "rcfilters-activefilters": "Title for the filters selection showing the active filters.",
        "rcfilters-restore-default-filters": "Label for the button that resets filters to defaults",
        "rcfilters-clear-all-filters": "Title for the button that clears all filters",
+       "rcfilters-clear-filters-to-defaults": "Title for the button that sets filters to default",
        "rcfilters-search-placeholder": "Placeholder for the filter search input.",
        "rcfilters-invalid-filter": "A label for an invalid filter.",
        "rcfilters-empty-filter": "Placeholder for the filter list when no filters were chosen.",
index 4ce326d..50aabb0 100644 (file)
@@ -1795,6 +1795,7 @@ return [
                        'rcfilters-activefilters',
                        'rcfilters-restore-default-filters',
                        'rcfilters-clear-all-filters',
+                       'rcfilters-clear-filters-to-defaults',
                        'rcfilters-search-placeholder',
                        'rcfilters-invalid-filter',
                        'rcfilters-empty-filter',
index 944ebaa..3f461c7 100644 (file)
                this.resetButton.setLabel(
                        currFiltersAreEmpty ? mw.msg( 'rcfilters-restore-default-filters' ) : ''
                );
+               this.resetButton.setTitle(
+                       currFiltersAreEmpty ?
+                               mw.msg( 'rcfilters-clear-filters-to-defaults' ) :
+                               mw.msg( 'rcfilters-clear-all-filters' )
+               );
 
                this.resetButton.toggle( !hideResetButton );
                this.emptyFilterMessage.toggle( currFiltersAreEmpty );
index e64a4c0..1fba18c 100644 (file)
                        }
                } 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 );
+                       }
                }
        };