Extension:CloudflarePurge

MediaWiki extensions manual
CloudflarePurge
Release status: stable
Description Purge the Cloudflare cache of edited and deleted pages
Author(s) Sophivorustalk
Latest version 1.1
MediaWiki >= 1.39.0
PHP 7.4+
License GNU General Public License 3.0 or later
Download
  • $wgCloudflarePurgeToken
  • $wgCloudflarePurgeAuthEmail
  • $wgCloudflarePurgeAuthKey
  • $wgCloudflarePurgeZoneID
Quarterly downloads 2 (Ranked 134th)
Translate the CloudflarePurge extension if it is available at translatewiki.net

The CloudflarePurge extension automatically purges the Cloudflare cache of edited and deleted pages.

Installation

  • Download and move the extracted CloudflarePurge folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/CloudflarePurge
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'CloudflarePurge' );
    $wgCloudflarePurgeZoneID = '';
    $wgCloudflarePurgeToken = '';
    
  •   Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration parameters

// Cloudflare Zone ID, see your Cloudflare Overview dashboard
$wgCloudflarePurgeZoneID = '';

// Cloudflare API Token with Cache Purge permission
$wgCloudflarePurgeToken = '';

To generate an API Token:

  1. Go to https://dash.cloudflare.com/profile/api-tokens
  2. Click "Create Token"
  3. Click "Get started" near "Create Custom Token"
  4. Fill the form:
    • Token name: Choose any convenient name (e.g., "MediaWiki Purge token")
    • Permissions: Zone → Cache Purge → Purge
    • Zone Resources: Include → Specific Zone → Select your target zone
  5. Click "Continue to summary"
  6. Click "Create token"
  7. Copy the generated token string and use it as $wgCloudflarePurgeToken

Legacy method (Global API Key)

// Cloudflare Zone ID, see your Cloudflare Overview dashboard
$wgCloudflarePurgeZoneID = '';

// Email address of your Cloudflare account
$wgCloudflarePurgeAuthEmail = '';

// Cloudflare Global API Key, see https://dash.cloudflare.com/profile/api-tokens
$wgCloudflarePurgeAuthKey = '';

See also