Skip the difference engine cache when 'action=purge' is used while requesting a diffe...
authorRob Church <robchurch@users.mediawiki.org>
Sun, 22 Jul 2007 23:37:01 +0000 (23:37 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sun, 22 Jul 2007 23:37:01 +0000 (23:37 +0000)
RELEASE-NOTES
includes/DifferenceEngine.php

index 167385d..5330d5c 100644 (file)
@@ -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 ==
 
index d659ed5..fbfab34 100644 (file)
@@ -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', "<nowiki>(fixme, bug)</nowiki>" ) );
                        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 );