daniel added a comment.

Also if someone updates the given message key it's going to stay there and not propagate through cache, because message keys are designed to be unchangeable.

...unless we track the message usage via templatelinks, with, as you said, will add one row for each (content) page in the wiki.

1- Hooks before parsing the page such as ParserBeforeInternalParse which makes us amend stuff to the wikitext before it gets parsed to HTML

This seems to be the best option to me, if we can overcome the tracking/parsing issue above.

One approach would be: if we know that ALL pages are using a specific template (or message), we don't need to track that in the database, we can just purge ALL pages when that template (or message) changes. However, puring ALL pages is a scary prospect... that's the main problem of this proposal in my mind.

2- After parsing and we would inject the HTML so we would need to sanatize (escape), fix caching and so many other problems.

Right, if we use the ParserAfterParse hook, we would probably run the parser against the message content manually; we probably can't use Message.parse(). That would need more investigation.

It should be mentioned that this option puts the resulting HTML into the ParserOutput object, making use of the parser cache.

3- Use PageBeforeDisplay hook which is as the same as 2.

It's not quite the sames as 2: PageBeforeDisplay is called every time the page is shown, even if it is not rendered. If use it, we cannot use the parser cache. But we would still have to re-parse the template/message very time, because we have to parse it in the context of the page being shown (so we can e.g. know which Wikidata item is connected). We cannot use the Message cache, since that would loose that context: the output would be the same for all pages.


TASK DETAIL
https://phabricator.wikimedia.org/T138652

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: daniel
Cc: daniel, Ladsgroup, aaron, Shizhao, Scott_WUaS, Mr.Ajedrez, dgstranz, Liuxinyu970226, jeblad, Lydia_Pintscher, hoo, Addshore, thiemowmde, Agabi10, Platonides, -jem-, Ivanhercaz, Krenair, Sjoerddebruin, Aklapper, abian, Zppix, JakeTheDeveloper, D3r1ck01, MuhammadShuaib, Izno, Psychoslave, Wikidata-bugs, aude, Arrbee, KartikMistry, TheDJ, Mbch331, Jay8g
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to