Page MenuHomePhabricator

Allow skins to optimize the data the template receives.
Open, MediumPublic

Description

Much of the data in SkinTemplate::getTemplateData is unused.

We want to be able to make breaking changes to the array returned by Skin::getTemplateData - this will result in removing certain array keys from the returned data object. This will cut down on PHP processing time and result in a more data orientated format which does not include raw HTML string.

For example

  • menu items generate a string html-items for legacy skins and also a more preferable array-items (used by SkinVector)
  • link-mainpage is generated inside SkinTemplate::
  • the SkinMustache::getCategories generates a template variable html-categories, but it also generates a data format inside data-portlets that gives more flexibility to the skin (https://github.com/wikimedia/mediawiki-skins-cli/blob/main/components/CategoryPortlet.mustache for example). On the long term we plan to port Vector to this format.

Ideas

Idea 1

Allow skin versioning
https://gerrit.wikimedia.org/r/c/mediawiki/core/+/894732

Idea 2

Allow skins to provide a list of keys that they want to generate or not generate (e.g. an inclusion/exclusion list)

Event Timeline

Change 894732 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/core@master] Skins: Allow versioning of skin data

https://gerrit.wikimedia.org/r/894732

Jdlrobson renamed this task from Allow versioning of Skin data to Allow skins to optimize the data the template receives..Nov 29 2023, 1:07 AM
Jdlrobson updated the task description. (Show Details)

Change 894732 abandoned by Jdlrobson:

[mediawiki/core@master] [POC] Skins: Allow versioning of skin data

Reason:

Not working on this right now. See also https://phabricator.wikimedia.org/T331360

https://gerrit.wikimedia.org/r/894732

Jdlrobson raised the priority of this task from Low to Medium.Jan 3 2024, 1:56 AM