Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Allows MediaWiki to force purge for anonymous requests, with ?action=purge&forcepurge=1. This is intended to be used when generating links webcrawlers shouldn't get.
diff --git a/includes/actions/PurgeAction.php b/includes/actions/PurgeAction.php
index cd58889..5a8cc6f 100644
--- a/includes/actions/PurgeAction.php
+++ b/includes/actions/PurgeAction.php
@@ -61,7 +61,8 @@ class PurgeAction extends FormAction {
// This will throw exceptions if there's a problem
$this->checkCanExecute( $this->getUser() );
- if ( $this->getUser()->isAllowed( 'purge' ) ) {
+ $forcePurge = isset( $_GET['forcepurge'] ) && ( $_GET['forcepurge'] == 1 );
+ if ( $forcePurge || $this->getUser()->isAllowed( 'purge' ) ) {
$this->redirectParams = wfArrayToCGI( array_diff_key(
$this->getRequest()->getQueryValues(),
array( 'title' => null, 'action' => null )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment