* (bug 2392) Fix Atom items content type, upgrade to Atom 1.0
* Allow $wgFeedCacheTimeout of 0 to disable feed caching
* Fix WebRequest::getRequestURL() to strip off the host bits squid prepends
+* Require POST for action=purge, to stop bots from purging the cache
=== Caveats ===
$wgOut->setArticleBodyOnly(true);
$this->view();
}
+
+ function purge() {
+ global $wgRequest, $wgOut, $wgUseSquid;
+
+ if ( $wgRequest->wasPosted() ) {
+ // Invalidate the cache
+ $this->mTitle->invalidateCache();
+
+ if ( $wgUseSquid ) {
+ // Commit the transaction before the purge is sent
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->immediateCommit();
+
+ // Send purge
+ $update = SquidUpdate::newSimplePurge( $this->mTitle );
+ $update->doUpdate();
+ }
+ // Redirect to the article
+ $wgOut->redirect( $this->mTitle->getFullURL() );
+ } else {
+ $msg = $wgOut->parse( wfMsg( 'confirm_purge' ) );
+ $action = $this->mTitle->escapeLocalURL( 'action=purge' );
+ $button = htmlspecialchars( wfMsg( 'confirm_purge_button' ) );
+ $msg = str_replace( '$1',
+ "<form method=\"post\" action=\"$action\">\n" .
+ "<input type=\"submit\" name=\"submit\" value=\"$button\" />\n" .
+ "</form>\n", $msg );
+
+ $wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
+ $wgOut->addHTML( $msg );
+ }
+ }
/**
* Insert a new empty page record for this article.
case 'validate':
case 'render':
case 'deletetrackback':
+ case 'purge':
$wgArticle->$action();
break;
case 'print':
$raw = new RawPage( $wgArticle );
$raw->view();
break;
- case 'purge':
- wfPurgeSquidServers(array($wgTitle->getInternalURL()));
- $wgOut->setSquidMaxage( $wgSquidMaxage );
- $wgTitle->invalidateCache();
- $wgArticle->view();
- break;
default:
if (wfRunHooks('UnknownAction', array($action, $wgArticle))) {
$wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
# HTML dump
'redirectingto' => 'Redirecting to [[$1]]...',
+# action=purge
+'confirm_purge' => "Clear the cache of this page?\n\n$1",
+'confirm_purge_button' => 'OK',
+
);
/* a fake language converter */