Enforcing DisableCache

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

In MediaWiki version 1.6 and early versions of 1.7, extensions cannot prevent articles from being cached when edited. A function in Article.php, editUpdates(), is called unilaterally. (See bugzilla:5683.) To restore expected behavior in these extensions, the following change must be made to Article.php.

In Article::editUpdates(), find this section of code:

                # Save it to the parser cache
                $parserCache =& ParserCache::singleton();
                $parserCache->save( $poutput, $this, $wgUser );

Then, replace it with this:

                # Save it to the parser cache
                if( $poutput->mCacheTime != -1 )
                {
                        $parserCache =& ParserCache::singleton();
                        $parserCache->save( $poutput, $this, $wgUser );
                }

WARNING: This hack has not been tested with squid or other external caching systems. Use at your own risk.