Page MenuHomePhabricator

always in parser cache after article save
Closed, ResolvedPublic

Description

Author: list-mediawiki2

Description:
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.


Version: 1.7.x
Severity: normal
OS: Linux
Platform: PC

Details

Reference
bz5683

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 9:11 PM
bzimport set Reference to bz5683.
bzimport added a subscriber: Unknown Object (MLST).

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?

list-mediawiki2 wrote:

test extension

attachment date.php ignored as obsolete

list-mediawiki2 wrote:

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.

robchur wrote:

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

Attached:

robchur wrote:

In light of comment 4, I'm going to resolve this WORKSFORME.

list-mediawiki2 wrote:

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.

robchur wrote:

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.

ross wrote:

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

robchur wrote:

Should now be fixed in SVN trunk, r14201.