From 6cb1fe1fe49039f88ed901f2677668ea7ba6771a Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Wed, 17 Oct 2012 11:00:07 +1100 Subject: [PATCH] Fixed the caching of redirects in Squid Was accidentally broken in Ie38ae198, where the request URL was compared against the final target title, not the title of the redirect. Also tested squid purges of redirects, since that code presumably hasn't been tested for a while, and committed my very advanced testing framework. Change-Id: Ib2ffe8e109bcc4859e22df5470bddfdb09e67afa --- includes/Wiki.php | 9 +++++---- includes/cache/SquidUpdate.php | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index ed02a3dab7..7a6b37d9fd 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -178,7 +178,7 @@ class MediaWiki { wfProfileIn( __METHOD__ ); $request = $this->context->getRequest(); - $title = $this->context->getTitle(); + $requestTitle = $title = $this->context->getTitle(); $output = $this->context->getOutput(); $user = $this->context->getUser(); @@ -302,7 +302,7 @@ class MediaWiki { global $wgArticle; $wgArticle = new DeprecatedGlobal( 'wgArticle', $article, '1.18' ); - $this->performAction( $article ); + $this->performAction( $article, $requestTitle ); } elseif ( is_string( $article ) ) { $output->redirect( $article ); } else { @@ -396,8 +396,9 @@ class MediaWiki { * Perform one of the "standard" actions * * @param $page Page + * @param $requestTitle The original title, before any redirects were applied */ - private function performAction( Page $page ) { + private function performAction( Page $page, Title $requestTitle ) { global $wgUseSquid, $wgSquidMaxage; wfProfileIn( __METHOD__ ); @@ -420,7 +421,7 @@ class MediaWiki { if ( $action instanceof Action ) { # Let Squid cache things if we can purge them. if ( $wgUseSquid && - in_array( $request->getFullRequestURL(), $title->getSquidURLs() ) + in_array( $request->getFullRequestURL(), $requestTitle->getSquidURLs() ) ) { $output->setSquidMaxage( $wgSquidMaxage ); } diff --git a/includes/cache/SquidUpdate.php b/includes/cache/SquidUpdate.php index a4b2002fe5..6b48fa4d14 100644 --- a/includes/cache/SquidUpdate.php +++ b/includes/cache/SquidUpdate.php @@ -129,6 +129,8 @@ class SquidUpdate { return; } + wfDebug( "Squid purge: " . implode( ' ', $urlArr ) . "\n" ); + if ( $wgHTCPMulticastRouting ) { SquidUpdate::HTCPPurge( $urlArr ); } -- 2.20.1