adding AbortDiffCache hook to allow canceling the caching of a diff
authorJack Phoenix <ashley@users.mediawiki.org>
Thu, 6 Nov 2008 21:41:07 +0000 (21:41 +0000)
committerJack Phoenix <ashley@users.mediawiki.org>
Thu, 6 Nov 2008 21:41:07 +0000 (21:41 +0000)
RELEASE-NOTES
docs/hooks.txt
includes/diff/DifferenceEngine.php

index 3350e12..5d6a00e 100644 (file)
@@ -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 ===
 
index 2c8e174..4fe332c 100644 (file)
@@ -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
index 0176ae8..393cdd1 100644 (file)
@@ -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 {