From 80e82bdf66c218781d2458cc1d8f9be1864f7346 Mon Sep 17 00:00:00 2001 From: Tom Hutchison Date: Fri, 11 Dec 2020 19:42:59 -0500 Subject: [PATCH 1/4] Fix to JS to Purge in place --- CHANGELOG.md | 4 ++++ extension.json | 4 ++-- resources/ext.purge.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1498a63..c3804ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Version 3.0.0 + +* Bump major version as it requires MW 1.35+ + ## Version 2.0.0 * Add extension registration. diff --git a/extension.json b/extension.json index 531c701..ed4283b 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "Purge", - "version": "2.0.0", + "version": "3.0.0", "author": [ "[https://www.mediawiki.org/wiki/User:Ævar_Arnfjörð_Bjarmason Ævar Arnfjörð Bjarmason]", "[https://www.mediawiki.org/wiki/User:Hutchy68 Tom Hutchison]", @@ -11,7 +11,7 @@ "license-name": "GPL-2.0+", "type": "other", "requires": { - "MediaWiki": ">= 1.31.0" + "MediaWiki": ">= 1.35.0" }, "MessagesDirs": { "Purge": [ diff --git a/resources/ext.purge.js b/resources/ext.purge.js index d587097..041ff59 100644 --- a/resources/ext.purge.js +++ b/resources/ext.purge.js @@ -1,5 +1,5 @@ -mw.loader.using( [ 'mediawiki.api', 'mediawiki.notify' ] ).then( function () { +mw.loader.using( [ 'mediawiki.api' ] ).then( function () { $( "#ca-purge a" ).on( 'click', function ( e ) { var postArgs = { action: 'purge', titles: mw.config.get( 'wgPageName' ) }; From 14680676aaf760fb0e0a1e5f8d60ec8b70f506a0 Mon Sep 17 00:00:00 2001 From: Tom Hutchison Date: Sun, 20 Dec 2020 11:43:21 -0500 Subject: [PATCH 2/4] action id change and wording of Purge menu item --- i18n/en.json | 4 ++-- includes/Hooks.php | 2 +- resources/ext.purge.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index 6a94c31..aa7e573 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -4,7 +4,7 @@ "Ævar Arnfjörð Bjarmason\r */\r" ] }, - "purge": "Purge", + "purge": "Cache Purge", "purge-descriptionmsg": "Adds a purge tab on all normal pages allowing for quick purging of the cache", - "purge-failed": "Purge failed" + "purge-failed": "Cache Purge failed" } diff --git a/includes/Hooks.php b/includes/Hooks.php index 72d5d81..e09acc8 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -22,7 +22,7 @@ public static function onSkinTemplateNavigation( SkinTemplate &$sktemplate, arra $action = $sktemplate->getRequest()->getText( 'action' ); $links['actions']['purge'] = [ - 'class' => $action === 'purge' ? 'selected' : false, + 'class' => $action === 'purge-ext' ? 'selected' : false, 'text' => wfMessage( 'purge' )->text(), 'href' => $title->getLocalUrl( 'action=purge' ) ]; diff --git a/resources/ext.purge.js b/resources/ext.purge.js index 041ff59..0c9e90c 100644 --- a/resources/ext.purge.js +++ b/resources/ext.purge.js @@ -1,7 +1,7 @@ mw.loader.using( [ 'mediawiki.api' ] ).then( function () { - $( "#ca-purge a" ).on( 'click', function ( e ) { + $( "#ca-purge-ext a" ).on( 'click', function ( e ) { var postArgs = { action: 'purge', titles: mw.config.get( 'wgPageName' ) }; new mw.Api().post( postArgs ).then( function () { location.reload(); From d47c72f9515ceaf5137323119cd1bcbc28548260 Mon Sep 17 00:00:00 2001 From: Hutchy68 Date: Sun, 20 Dec 2020 13:39:49 -0500 Subject: [PATCH 3/4] Tooltip fix and change to accesskey --- i18n/en.json | 6 ++++-- i18n/qqq.json | 6 ++++-- includes/Hooks.php | 8 +++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index aa7e573..a07e888 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -4,7 +4,9 @@ "Ævar Arnfjörð Bjarmason\r */\r" ] }, - "purge": "Cache Purge", + "purge": "Purge cache", "purge-descriptionmsg": "Adds a purge tab on all normal pages allowing for quick purging of the cache", - "purge-failed": "Cache Purge failed" + "purge-failed": "Cache Purge failed", + "tooltip-n-purge-ext": "Purge cache of the current page", + "accesskey-n-purge-ext": "~" } diff --git a/i18n/qqq.json b/i18n/qqq.json index f5a26bc..f056b53 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -9,7 +9,9 @@ "The Evil IP address" ] }, - "purge": "Displayed as a label in the action menu.\n{{Identical|Purge}}", + "purge": "Displayed as a label in the action menu.\n{{Identical|Purge cache}}", "purge-descriptionmsg": "{{desc|name=Purge|url=https://www.mediawiki.org/wiki/Extension:Purge}}\n\"purge\" refers to {{msg-mw|purge}}.", - "purge-failed": "Displayed when the POST request to purge did not succeed." + "purge-failed": "Displayed when the POST request to purge did not succeed.", + "tooltip-n-purge-ext": "Tooltip of the dedicated \"Purge\" action.\n{{Identical|Purge cache}}", + "accesskey-n-purge-ext": "{{doc-accesskey}}" } diff --git a/includes/Hooks.php b/includes/Hooks.php index e09acc8..c22bc1e 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -21,10 +21,12 @@ public static function onSkinTemplateNavigation( SkinTemplate &$sktemplate, arra $sktemplate->getOutput()->addModules( 'ext.purge' ); $action = $sktemplate->getRequest()->getText( 'action' ); - $links['actions']['purge'] = [ - 'class' => $action === 'purge-ext' ? 'selected' : false, + $links['actions']['purge-ext'] = [ + 'class' => $action === 'purge' ? 'selected' : false, 'text' => wfMessage( 'purge' )->text(), - 'href' => $title->getLocalUrl( 'action=purge' ) + 'href' => $title->getLocalUrl( 'action=purge' ), + 'title' => wfMessage( 'Tooltip-n-purge-ext' ), + 'accesskey' => wfMessage( 'Accesskey-n-purge-ext' ) ]; } From e64481c36c04fdb04f11ee0fa0d6e31c9749c2cd Mon Sep 17 00:00:00 2001 From: Hutchy68 Date: Sun, 20 Dec 2020 22:47:28 -0500 Subject: [PATCH 4/4] Final fixes includes text similar to mediawiki permissions manual page --- i18n/en.json | 2 +- includes/Hooks.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/i18n/en.json b/i18n/en.json index a07e888..dc1325a 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -7,6 +7,6 @@ "purge": "Purge cache", "purge-descriptionmsg": "Adds a purge tab on all normal pages allowing for quick purging of the cache", "purge-failed": "Cache Purge failed", - "tooltip-n-purge-ext": "Purge cache of the current page", + "tooltip-n-purge-ext": "Purge the cache for this page", "accesskey-n-purge-ext": "~" } diff --git a/includes/Hooks.php b/includes/Hooks.php index c22bc1e..cc2ce52 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -25,8 +25,8 @@ public static function onSkinTemplateNavigation( SkinTemplate &$sktemplate, arra 'class' => $action === 'purge' ? 'selected' : false, 'text' => wfMessage( 'purge' )->text(), 'href' => $title->getLocalUrl( 'action=purge' ), - 'title' => wfMessage( 'Tooltip-n-purge-ext' ), - 'accesskey' => wfMessage( 'Accesskey-n-purge-ext' ) + 'title' => wfMessage( 'Tooltip-n-purge-ext' )->text(), + 'accesskey' => wfMessage( 'Accesskey-n-purge-ext' )->text() ]; }