Merge "Always log exceptions in rollbackMasterChangesAndLog()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 30 Jun 2017 23:33:34 +0000 (23:33 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 30 Jun 2017 23:33:34 +0000 (23:33 +0000)
includes/filerepo/file/LocalFile.php
includes/page/WikiFilePage.php
includes/resourceloader/ResourceLoaderSkinModule.php
languages/i18n/en.json
languages/i18n/qqq.json
resources/Resources.php
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterMenuHeaderWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.FilterTagMultiselectWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.SaveFiltersPopupButtonWidget.js
resources/src/mediawiki.rcfilters/ui/mw.rcfilters.ui.SavedLinksListItemWidget.js

index a412250..f71e1dc 100644 (file)
@@ -1032,9 +1032,15 @@ class LocalFile extends File {
 
                $purgeList = [];
                foreach ( $files as $file ) {
-                       # Check that the base file name is part of the thumb name
+                       if ( $this->repo->supportsSha1URLs() ) {
+                               $reference = $this->getSha1();
+                       } else {
+                               $reference = $this->getName();
+                       }
+
+                       # Check that the reference (filename or sha1) is part of the thumb name
                        # This is a basic sanity check to avoid erasing unrelated directories
-                       if ( strpos( $file, $this->getName() ) !== false
+                       if ( strpos( $file, $reference ) !== false
                                || strpos( $file, "-thumbnail" ) !== false // "short" thumb name
                        ) {
                                $purgeList[] = "{$dir}/{$file}";
index 66fadf5..972a397 100644 (file)
@@ -170,21 +170,31 @@ class WikiFilePage extends WikiPage {
         */
        public function doPurge() {
                $this->loadFile();
+
                if ( $this->mFile->exists() ) {
                        wfDebug( 'ImagePage::doPurge purging ' . $this->mFile->getName() . "\n" );
                        DeferredUpdates::addUpdate( new HTMLCacheUpdate( $this->mTitle, 'imagelinks' ) );
-                       $this->mFile->purgeCache( [ 'forThumbRefresh' => true ] );
                } else {
                        wfDebug( 'ImagePage::doPurge no image for '
                                . $this->mFile->getName() . "; limiting purge to cache only\n" );
-                       // even if the file supposedly doesn't exist, force any cached information
-                       // to be updated (in case the cached information is wrong)
-                       $this->mFile->purgeCache( [ 'forThumbRefresh' => true ] );
                }
+
+               // even if the file supposedly doesn't exist, force any cached information
+               // to be updated (in case the cached information is wrong)
+
+               // Purge current version and its thumbnails
+               $this->mFile->purgeCache( [ 'forThumbRefresh' => true ] );
+
+               // Purge the old versions and their thumbnails
+               foreach ( $this->mFile->getHistory() as $oldFile ) {
+                       $oldFile->purgeCache( [ 'forThumbRefresh' => true ] );
+               }
+
                if ( $this->mRepo ) {
                        // Purge redirect cache
                        $this->mRepo->invalidateImageRedirect( $this->mTitle );
                }
+
                return parent::doPurge();
        }
 
index 5740925..1967a95 100644 (file)
  */
 
 class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
+       /**
+        * All skins are assumed to be compatible with mobile
+        */
+       public $targets = [ 'desktop', 'mobile' ];
 
        /**
         * @param ResourceLoaderContext $context
index 966439b..606203b 100644 (file)
        "rcfilters-tag-prefix-namespace-inverted": "<strong>:not</strong> $1",
        "rcfilters-tag-prefix-tags": "#$1",
        "rcfilters-view-tags": "Tagged edits",
+       "rcfilters-view-namespaces-tooltip": "Filter results by namespace",
+       "rcfilters-view-tags-tooltip": "Filter results using edit tags",
+       "rcfilters-view-return-to-default-tooltip": "Return to main filter menu",
        "rcnotefrom": "Below {{PLURAL:$5|is the change|are the changes}} since <strong>$3, $4</strong> (up to <strong>$1</strong> shown).",
        "rclistfromreset": "Reset date selection",
        "rclistfrom": "Show new changes starting from $2, $3",
index d03da1f..d4f5285 100644 (file)
        "rcfilters-tag-prefix-namespace-inverted": "Prefix for the namespace inverted tags in [[Special:RecentChanges]]. Namespace tags use a colon (:) as prefix. Please keep this format.\n\nParameters:\n* $1 - Filter name.",
        "rcfilters-tag-prefix-tags": "Prefix for the edit tags in [[Special:RecentChanges]]. Edit tags use a hash (#) as prefix. Please keep this format.\n\nParameters:\n* $1 - Tag display name.",
        "rcfilters-view-tags": "Title for the tags view in [[Special:RecentChanges]]\n{{Identical|Tag}}",
+       "rcfilters-view-namespaces-tooltip": "Tooltip for the button that loads the namespace view in [[Special:RecentChanges]]",
+       "rcfilters-view-tags-tooltip": "Tooltip for the button that loads the tags view in [[Special:RecentChanges]]",
+       "rcfilters-view-return-to-default-tooltip": "Tooltip for the button that returns to the default filter view in [[Special:RecentChanges]]",
        "rcnotefrom": "This message is displayed at [[Special:RecentChanges]] when viewing recentchanges from some specific time.\n\nThe corresponding message is {{msg-mw|Rclistfrom}}.\n\nParameters:\n* $1 - the maximum number of changes that are displayed\n* $2 - (Optional) a date and time\n* $3 - a date\n* $4 - a time\n* $5 - Number of changes are displayed, for use with PLURAL",
        "rclistfromreset": "Used on [[Special:RecentChanges]] to reset a selection of a certain date range.",
        "rclistfrom": "Used on [[Special:RecentChanges]]. Parameters:\n* $1 - (Currently not use) date and time. The date and the time adds to the rclistfrom description.\n* $2 - time. The time adds to the rclistfrom link description (with split of date and time).\n* $3 - date. The date adds to the rclistfrom link description (with split of date and time).\n\nThe corresponding message is {{msg-mw|Rcnotefrom}}.",
index 156f967..12f482f 100644 (file)
@@ -238,6 +238,7 @@ return [
                'scripts' => 'resources/lib/jquery/jquery.fullscreen.js',
        ],
        'jquery.getAttrs' => [
+               'targets' => [ 'desktop', 'mobile' ],
                'scripts' => 'resources/src/jquery/jquery.getAttrs.js',
                'targets' => [ 'desktop', 'mobile' ],
        ],
@@ -325,6 +326,7 @@ return [
                'scripts' => 'resources/lib/jquery/jquery.jStorage.js',
        ],
        'jquery.suggestions' => [
+               'targets' => [ 'desktop', 'mobile' ],
                'scripts' => 'resources/src/jquery/jquery.suggestions.js',
                'styles' => 'resources/src/jquery/jquery.suggestions.css',
                'dependencies' => 'jquery.highlightText',
@@ -1182,6 +1184,7 @@ return [
                'styles' => 'resources/src/mediawiki/mediawiki.pager.tablePager.less',
        ],
        'mediawiki.searchSuggest' => [
+               'targets' => [ 'desktop', 'mobile' ],
                'scripts' => 'resources/src/mediawiki/mediawiki.searchSuggest.js',
                'styles' => 'resources/src/mediawiki/mediawiki.searchSuggest.css',
                'messages' => [
@@ -1853,6 +1856,9 @@ return [
                        'rcfilters-tag-prefix-namespace-inverted',
                        'rcfilters-tag-prefix-tags',
                        'rcfilters-view-tags',
+                       'rcfilters-view-namespaces-tooltip',
+                       'rcfilters-view-tags-tooltip',
+                       'rcfilters-view-return-to-default-tooltip',
                        'blanknamespace',
                        'namespaces',
                        'invert',
index 0138884..d0ad8d5 100644 (file)
@@ -29,7 +29,7 @@
                this.backButton = new OO.ui.ButtonWidget( {
                        icon: 'previous',
                        framed: false,
-                       title: mw.msg( 'rcfilters-filterlist-title' ),
+                       title: mw.msg( 'rcfilters-view-return-to-default-tooltip' ),
                        classes: [ 'mw-rcfilters-ui-filterMenuHeaderWidget-backButton' ]
                } );
                this.backButton.toggle( this.model.getCurrentView() !== 'default' );
index 9671f5e..4bee31e 100644 (file)
                                        new OO.ui.ButtonOptionWidget( {
                                                data: 'namespaces',
                                                icon: 'article',
-                                               title: mw.msg( 'namespaces' )
+                                               title: mw.msg( 'rcfilters-view-namespaces-tooltip' )
                                        } ),
                                        new OO.ui.ButtonOptionWidget( {
                                                data: 'tags',
                                                icon: 'tag',
-                                               title: mw.msg( 'rcfilters-view-tags' )
+                                               title: mw.msg( 'rcfilters-view-tags-tooltip' )
                                        } )
                                ]
                        } );
index 62f7aee..dfb188d 100644 (file)
         * @param {string} value Input value
         */
        mw.rcfilters.ui.SaveFiltersPopupButtonWidget.prototype.onInputChange = function ( value ) {
+               value = value.trim();
+
                this.applyButton.setDisabled( !value );
        };
 
         * Apply and add the new quick link
         */
        mw.rcfilters.ui.SaveFiltersPopupButtonWidget.prototype.apply = function () {
-               var label = this.input.getValue();
+               var label = this.input.getValue().trim();
 
                // This condition is more for sanity-check, since the
                // apply button should be disabled if the label is empty
index 7ce9b6a..b6b20ee 100644 (file)
                this.menu.connect( this, {
                        choose: 'onMenuChoose'
                } );
-               this.saveButton.connect( this, { click: 'onSaveButtonClick' } );
-               this.editInput.connect( this, { enter: 'onEditInputEnter' } );
+               this.saveButton.connect( this, { click: 'save' } );
+               this.editInput.connect( this, {
+                       change: 'onInputChange',
+                       enter: 'save'
+               } );
                this.editInput.$input.on( {
                        blur: this.onInputBlur.bind( this ),
                        keyup: this.onInputKeyup.bind( this )
                this.menu.toggle( false );
        };
 
-       /**
-        * Respond to save button click
-        */
-       mw.rcfilters.ui.SavedLinksListItemWidget.prototype.onSaveButtonClick = function () {
-               this.emit( 'edit', this.editInput.getValue() );
-               this.toggleEdit( false );
-       };
-
-       /**
-        * Respond to input enter event
-        */
-       mw.rcfilters.ui.SavedLinksListItemWidget.prototype.onEditInputEnter = function () {
-               this.emit( 'edit', this.editInput.getValue() );
-               this.toggleEdit( false );
-       };
-
        /**
         * Respond to input keyup event, this is the way to intercept 'escape' key
         *
         * Respond to blur event on the input
         */
        mw.rcfilters.ui.SavedLinksListItemWidget.prototype.onInputBlur = function () {
-               this.emit( 'edit', this.editInput.getValue() );
+               this.save();
+
+               // Whether the save succeeded or not, the input-blur event
+               // means we need to cancel editing mode
                this.toggleEdit( false );
        };
 
+       /**
+        * Respond to input change event
+        *
+        * @param {string} value Input value
+        */
+       mw.rcfilters.ui.SavedLinksListItemWidget.prototype.onInputChange = function ( value ) {
+               value = value.trim();
+
+               this.saveButton.setDisabled( !value );
+       };
+
+       /**
+        * Save the name of the query
+        *
+        * @param {string} [value] The value to save
+        * @fires edit
+        */
+       mw.rcfilters.ui.SavedLinksListItemWidget.prototype.save = function () {
+               var value = this.editInput.getValue().trim();
+
+               if ( value ) {
+                       this.emit( 'edit', value );
+                       this.toggleEdit( false );
+               }
+       };
+
        /**
         * Toggle edit mode on this widget
         *