Extension:PurgePage
From MediaWiki.org
|
Release status: unknown |
|
|---|---|
| Implementation | Tag |
| Description | Allows for the easy implementation of keeping a page uncached. |
| Author(s) | Andrew Nicol |
| MediaWiki | 1.3+ |
| License | No license specified |
| Download | see below |
|
check usage (experimental) |
|
[edit] Installation
- Copy the code below to extensions/purgePage.php
- Add include("extensions/purgePage.php"); to your LocalSettings.php
<?php # purgePage.php (for MediaWiki 1.3 - 1.5) # # By: Andrew Nicol # http://www.nanfo.com # # This extention allows for the easy implementation of keeping a page # uncached, to use it you can either call the purgePage() function # from another extention or add the following tags to you wiki page: # <purge/> # To activate the extension, include it from your LocalSettings.php # with: include("extensions/purgePage.php"); $wgExtensionFunctions[] = "wfPurge"; function wfPurge() { global $wgParser; # register the extension with the WikiText parser # the first parameter is the name of the new tag. # In this case it defines the tag <purge></purge> # the second parameter is the callback function for # processing the text between the tags $wgParser->setHook( "purge", "purgePage" ); } # The callback function for perfoming the purge function purgePage( ) { //For MediaWiki 1.5 uncomment the following, and comment out 1.4 & 1.3 below /* global $wgParser; $wgParser->disableCache(); */ //For MediaWiki 1.4 uncomment the following, and comment out 1.5 above & 1.3 below global $wgTitle; wfPurgeSquidServers(array($wgTitle->getInternalURL())); $wgTitle->invalidateCache(); //For MediaWiki 1.3 uncomment the following, and comment out 1.4 & 1.5 above /* global $wgOut; $wgOut->enableClientCache(false); */ //Return must be present for all version of MediaWiki return ""; } ?>