From: Rob Church Date: Sun, 22 Jul 2007 23:37:01 +0000 (+0000) Subject: Skip the difference engine cache when 'action=purge' is used while requesting a diffe... X-Git-Tag: 1.31.0-rc.0~51987 X-Git-Url: http://git.cyclocoop.org/%22.%24image2.%22?a=commitdiff_plain;h=4aaa56665c4cb1d57b472039a7a2b0a9a8252896;p=lhc%2Fweb%2Fwiklou.git Skip the difference engine cache when 'action=purge' is used while requesting a difference page, to allow refreshing the cache in case of errors --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 167385d318..5330d5c60b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -156,6 +156,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9595) Pass new Revision to the 'ArticleInsertComplete' and 'ArticleSaveComplete' hooks; see docs/hooks.txt for more information * (bug 9575) Accept upload description from GET parameters +* Skip the difference engine cache when 'action=purge' is used while requesting + a difference page, to allow refreshing the cache in case of errors == Bugfixes since 1.10 == diff --git a/includes/DifferenceEngine.php b/includes/DifferenceEngine.php index d659ed5dbb..fbfab343fc 100644 --- a/includes/DifferenceEngine.php +++ b/includes/DifferenceEngine.php @@ -290,8 +290,8 @@ CONTROL; * Returns false if the diff could not be generated, otherwise returns true */ function showDiff( $otitle, $ntitle ) { - global $wgOut; - $diff = $this->getDiff( $otitle, $ntitle ); + global $wgOut, $wgRequest; + $diff = $this->getDiff( $otitle, $ntitle, $wgRequest->getVal( 'action' ) == 'purge' ); if ( $diff === false ) { $wgOut->addWikitext( wfMsg( 'missingarticle', "(fixme, bug)" ) ); return false; @@ -314,12 +314,15 @@ CONTROL; } /** - * Get diff table, including header - * Note that the interface has changed, it's no longer static. - * Returns false on error + * Get complete diff table, including header + * + * @param Title $otitle Old title + * @param Title $ntitle New title + * @param bool $skipCache Skip the diff cache for this request? + * @return mixed */ - function getDiff( $otitle, $ntitle ) { - $body = $this->getDiffBody(); + function getDiff( $otitle, $ntitle, $skipCache = false ) { + $body = $this->getDiffBody( $skipCache ); if ( $body === false ) { return false; } else { @@ -330,17 +333,18 @@ CONTROL; /** * Get the diff table body, without header - * Results are cached - * Returns false on error + * + * @param bool $skipCache Skip cache for this request? + * @return mixed */ - function getDiffBody() { + function getDiffBody( $skipCache = false ) { global $wgMemc; $fname = 'DifferenceEngine::getDiffBody'; wfProfileIn( $fname ); // Cacheable? $key = false; - if ( $this->mOldid && $this->mNewid ) { + if ( $this->mOldid && $this->mNewid && !$skipCache ) { // Try cache $key = wfMemcKey( 'diff', 'version', MW_DIFF_VERSION, 'oldid', $this->mOldid, 'newid', $this->mNewid ); $difftext = $wgMemc->get( $key );