Last modified: 2006-05-13 17:41:14 UTC
After upgrading from version 1.5, the latest version of MediaWiki has an undesirable feature when saving an article. Article::editUpdates is always called whenever an article is saved. In editUpdates, the article is unconditionally saved into the parser cache. This makes it difficult for an extension that generates dynamic content to disable the parser cache (with Parser::disableCache()). A manual cache purge after article save allows an extension to again disable caching.
It's supposed to be cached, that's normal -- and highly desirable as it reduces the number of unnecessary repeated renderings. Can you provide some minimal sample code for an extension that disables caching in the manner you describe?
Created attachment 1599 [details] test extension
The attachment creates a new date tag which simply displays the current time. If the extension is enabled, a page with the date tag is edited and saved, then the page is displayed with the time of the save. Reloading the page will not update the time (which is not what is desired). If the parser cache is manually purged, then reloads of the page will update the time as desired. I'm not saying that the cache is undesirable, just that it is undesirable to be automatic after a page save. If it isn't saved into the cache immediately after save, then it would be normally saved into the cache on the next view, thus the cost of removing this would only be one extra rendering. If an extension wants to disable the parser cache, it can catch the second rendering and not allow it to enter into the cache. The alternative would be to provide a way for an extension to not have a page be cached after save.
Created attachment 1600 [details] Working version Working version, fixes two oversights: 1. Parser::disableCache() is a function, not a member 2. You need to accept a reference to the parser when the tag is rendered and use that to disable the cache
In light of comment 4, I'm going to resolve this WORKSFORME.
That doesn't fix the problem. You are correct the disableCache was messed up (and I didn't notice it because I was disabling the cache via something else on my test page) but that isn't the problem. Also, using the global $wgParser or the passed in parser variable doesn't change anything. In fact, comparing the two values, they are identical. If you think it fixes the problem, then please explain why you think the page using this extension would not be cached on a page save. disableCache() only sets a variable that is never checked on page save.
On closer inspection, you're correct; clearly the system I used to test my version of the extension had something disabled elsewhere. I've tracked down what I think the problem is, but I don't plan on committing the patch without having it reviewed first, since a problem with the parser cache would cause the Wikimedia cluster to fall over in short order.
Hi all, I've posted a workaround hack for this bug on Meta: http://meta.wikimedia.org/wiki/Enforcing_DisableCache I'd appreciate feedback, particularly if it turns out to not work as it should. Thanks, Algorithm
Should now be fixed in SVN trunk, r14201.