From 3eb0e98e2cd78b3da6e6d29dca6f8329db05e98e Mon Sep 17 00:00:00 2001 From: Jack Phoenix Date: Thu, 6 Nov 2008 21:41:07 +0000 Subject: [PATCH] adding AbortDiffCache hook to allow canceling the caching of a diff --- RELEASE-NOTES | 1 + docs/hooks.txt | 3 +++ includes/diff/DifferenceEngine.php | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3350e12f63..5d6a00e076 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -196,6 +196,7 @@ The following extensions are migrated into MediaWiki 1.14: * Added the BitmapHandler_ClientOnly media handler, which allows server-side image scaling to be completely disabled for specific media types, via the $wgMediaHandlers configuration variable. +* New 'AbortDiffCache' hook can be used to cancel the caching of a diff === Bug fixes in 1.14 === diff --git a/docs/hooks.txt b/docs/hooks.txt index 2c8e1746c0..4fe332c011 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -238,6 +238,9 @@ to add events to the MediaWiki code. $autoblockip: The IP going to be autoblocked. $block: The block from which the autoblock is coming. +'AbortDiffCache': Can be used to cancel the caching of a diff +&$diffEngine: DifferenceEngine object + 'AbortLogin': Return false to cancel account login. $user: the User object being authenticated against $password: the password being submitted, not yet checked for validity diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 0176ae8659..393cdd1e80 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -546,7 +546,9 @@ CONTROL; $difftext = $this->generateDiffBody( $this->mOldtext, $this->mNewtext ); // Save to cache for 7 days - if ( $key !== false && $difftext !== false ) { + if ( !wfRunHooks( 'AbortDiffCache', array( &$this ) ) ) { + wfIncrStats( 'diff_uncacheable' ); + } else if ( $key !== false && $difftext !== false ) { wfIncrStats( 'diff_cache_miss' ); $wgMemc->set( $key, $difftext, 7*86400 ); } else { -- 2.20.1