Page MenuHomePhabricator

Export extension.json "ResourceModules" as attribute instead of config
Closed, ResolvedPublic

Description

Refactor this internal extension.json property to be exported as attribute – via ExtensionRegistry->getAttribute('ResourceModules') – instead of as wgResourceModules global.

This way, ExtensionRegistry and ExtensionProcessor will not have to read and export it unconditionally during request initialisation. Instead, it will be retrieved by ResourceLoader if and when needed only. This is a prerequisite for making it a lazy-loaded attribute.

This will help with requests where ResourceLoader is never instantiated, such as most api.php and rest.php requests, most CLI and JobRunner processes, and and possibly some of index.php requests as well.

Event Timeline

Krinkle created this task.Mar 9 2020, 7:09 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 9 2020, 7:09 PM

Change 578372 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/Cite@master] CiteHooks: Remove wgResourceModules check (redundant with isModuleRegistered)

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

Change 578376 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/Flow@master] Make use of QUnitTestModule extension.json attribute

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

Change 578379 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/extensions/UploadWizard@master] Use ResourceLoader::isModuleRegistered instead of wgResourceModules

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

Change 578382 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Export ResourceModuleSkinStyles as extension attribute

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

Change 578383 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Export ResourceModules as extension attribute

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

Requesting code review for the following two patches:

[mediawiki/core@master] resourceloader: Export ResourceModuleSkinStyles as extension attribute
https://gerrit.wikimedia.org/r/578382

[mediawiki/core@master] resourceloader: Export ResourceModules as extension attribute
https://gerrit.wikimedia.org/r/578383

These is needed to reduce the cost that ExtensionRegistry is incurring on all MW web requests, which regressed as part of the PHP7 migration (details at T187154).

This refactor also helps with the decoupling effort as it means these two configuration variables are now properly dependency-injected via ServiceWiring, and it marks a milestone part of making RL more standalone (the patches are also tagged with T32956).

Krinkle triaged this task as Medium priority.Mar 9 2020, 9:51 PM
DannyS712 updated the task description. (Show Details)Mar 10 2020, 12:13 AM

Change 578376 merged by jenkins-bot:
[mediawiki/extensions/Flow@master] Make use of QUnitTestModule extension.json attribute

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

Change 578372 merged by jenkins-bot:
[mediawiki/extensions/Cite@master] CiteHooks: Remove wgResourceModules check (redundant with isModuleRegistered)

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

Change 578379 merged by jenkins-bot:
[mediawiki/extensions/UploadWizard@master] Use ResourceLoader::isModuleRegistered instead of wgResourceModules

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

Change 578382 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Export ResourceModuleSkinStyles as extension attribute

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

Change 578383 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Export ResourceModules as extension attribute

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

Krinkle closed this task as Resolved.Apr 2 2020, 2:20 AM