Page MenuHomePhabricator

Add two hooks to Scribunto so that Module pages can be changed based on a "branch" parameter set in an invoke
Open, Needs TriagePublicFeature

Description

Feature summary: This is the commit I would like added. I'm not sure if these are the exact versions of the hooks that make the most sense, e.g. maybe the parameters should be reordered, or some other ones added, for more general use cases, but these are the ones I needed for my use case.

Use case(s): Currently it is very hard to sandbox Lua changes when there are cascading dependencies, e.g. Module:Team requires Module:ArgsUtil which requires Module:MapUtil which requires Module:TabeUtil. If you want to test a change to Module:TableUtil and see how it impacts this dependency chain, you have to create 4 sandbox pages. I would like to be able to create only a single sandbox page, Module:TableUtil/sandbox, and then write {{#invoke:Team|main|_branch=sandbox}} and then everything automatically is solved for me.

Benefits: If these hooks are added to Scribunto, I can publish my extension Lua Branches, which solves this use case. I also wrote a blog post about it.

Event Timeline

This seems like an interesting concept, but our current strategy to allow overriding the contents of a page is through TemplateSandbox. Would modifying that to support overriding multiple pages instead of just one address your use case?

Hm, it looks like that only allows you to preview the page, and I'd prefer to be able to save it as well (e.g. this is a way for someone to submit changes and propose them so they'd want to link the result instead of just screenshotting). But since I figured a patch to Scribunto is unlikely to happen, previewing would still be a good compromise I think.

I did submit a patch btw, it's not showing up here since I'm bad at gerrit though: https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Scribunto/+/804439

Change 804439 had a related patch set uploaded (by Legoktm; author: RheingoldRiver):

[mediawiki/extensions/Scribunto@master] Add hooks GetInvokeOptions, LoadPackageModuleTitle

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