Page MenuHomePhorge

The purge user "right" is ignored in mw1.28+
Open, NormalPublic

Description

Submitting action=purge in the query string to index.php always requires confirmation. The purge user right is ignored.
(Although 1.28 hit WikiMedia wikis a while ago, there are still people complaining about this change.)

I have added the following to MediaWiki:Common.js on hub. I suggest putting it in Global.js for all wikis.

/**
 * For action=purge to index.php
 *   change it to POST api.php
 *   then reload the page
 * Restores pre-1.28 behavior to MW 1.28+
 * Based on meta:User:Glaisher/autoPurge.js, 21 Aug 2016
 */
if (( mw.config.get( 'wgAction' ) === 'purge' ) &&
	( $.inArray( 'user', mw.config.get( 'wgUserGroups' )) + 1 )) {
	$.post( mw.config.get( 'wgScriptPath' ) + '/api.php', {
		format: 'none',
		action: 'purge',
		titles: mw.config.get( 'wgPageName' ).replace( /_/g, ' ' )
	}, function () {
		// remove action=purge, but keep the rest
		location.replace(
			location.pathname +
			location.search
				.replace( /(?:\?|&)action=purge$/i, '' )
				.replace( /(\?|&)action=purge&/i, '$1' ) +
			location.hash
		);
	} );
}

I can do it, but there's the admonition ...

Do not edit this unless you are staff or have direct staff approval.

... so a ticket seems appropriate.