$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}";
*/
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();
}
*/
class ResourceLoaderSkinModule extends ResourceLoaderFileModule {
+ /**
+ * All skins are assumed to be compatible with mobile
+ */
+ public $targets = [ 'desktop', 'mobile' ];
/**
* @param ResourceLoaderContext $context
"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",
"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}}.",
'scripts' => 'resources/lib/jquery/jquery.fullscreen.js',
],
'jquery.getAttrs' => [
+ 'targets' => [ 'desktop', 'mobile' ],
'scripts' => 'resources/src/jquery/jquery.getAttrs.js',
'targets' => [ 'desktop', 'mobile' ],
],
'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',
'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' => [
'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',
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' );
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' )
} )
]
} );
* @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
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
*