Title says it all: We cache the edit buttons on entity pages, although their visibility depends on user rights.
Eg. if an IP purges an edit=autoconfirmed item the edit buttons will be gone for everybody.
Title says it all: We cache the edit buttons on entity pages, although their visibility depends on user rights.
Eg. if an IP purges an edit=autoconfirmed item the edit buttons will be gone for everybody.
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Split parser cache by editsection flag | mediawiki/extensions/Wikibase | master | +19 -4 |
Added wikidata-bugs as a CC as adding Wikidata as a project isn't possible for some reason (@Aklapper)
Investigating this took me deep into the wonderful land of ParserOptions, ParserOutput, ParserCache and OutputPage.
So the issue is that the parser cache should be split on whether "editsection" links are present in the output. But MediaWiki doesn't do that. So here is what I found.
So, Parser::clearState enables the automatic splitting of the cache by registering the ParserOutput was a watcher to the ParserOptions. But Wikibase doesn't use the parser, and EntityParserOutputGerator doesn't register the watcher. So no automated splitting.
Now the splitting by user language is automatic (we do that somewhere explicitly - that's no longer needed then, I suppose). But it still doesn't work for editsection.
As it turns out, ParserOptions::getEditSection does not call $this->optionUsed( 'editsection' ), as I expected, following the example of getUserLang(), getThumbSize(), etc. The reason it doesn't is apparently another magic trick:
We could try to use that mechanism by putting an <mw:editsection> tag into the wikibase-toolbar-bracketed template, and then customizing the output via the DoEditSectionLink hook called by Skin::doEditSectionLink.
But the simples solution would be to just call $parserOutput->recordOption( 'editsection' ) in EntityParserOutputGenerator. We don't even need to set up the "split cache automatically via watcher" magic for that to work, though I think we should do that anyway.
Change 192976 had a related patch set uploaded (by Tobias Gritschacher):
Split parser cache by editsection flag