Skip to content

Instantly share code, notes, and snippets.

@dereckson
Created January 2, 2013 22:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save dereckson/4438948 to your computer and use it in GitHub Desktop.
Save dereckson/4438948 to your computer and use it in GitHub Desktop.
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