⚓ T120794 Create redirect when moving modules
Page Menu
Phabricator
Create Task
Maniphest
T120794
Create redirect when moving modules
Closed, Resolved
Public
Actions
Edit Task
Edit Related Tasks...
Create Subtask
Edit Parent Tasks
Edit Subtasks
Merge Duplicates In
Close As Duplicate
Edit Related Objects...
Edit Commits
Edit Mocks
Mute Notifications
Protect as security issue
Assigned To
cscott
Authored By
GTrang
Dec 8 2015, 2:13 AM
2015-12-08 02:13:16 (UTC+0)
Tags
Scribunto
(Backlog)
User-DannyS712
(Awaiting review and deployment)
Platform Engineering (Icebox)
MW-1.42-notes (1.42.0-wmf.10; 2023-12-19)
MediaWiki CodeJam Dec 2023
(Done / Ready for Showcase)
User-notice-archive
(Backlog)
Referenced Files
None
Subscribers
Ahecht
Aklapper
andymw
Bean49
Carn
DannyS712
Dvorapa
View All 25 Subscribers
Description
When moving a module called "A" to a module called "B", Module:A should say "return require('Module:B')". Also,
should be implemented. Redirects for js and css pages have already been enabled per
T73200: Support redirects in JavaScriptContent
and
T73201: Support redirects in CssContent
Details
Related Changes in Gerrit:
Subject
Repo
Branch
Lines +/-
Add redirects for modules
mediawiki/extensions/Scribunto
master
+183
-3
Add redirect support to modules
mediawiki/extensions/Scribunto
master
+155
-2
Customize query in gerrit
Related Objects
Mentions
Duplicates
Mentioned In
T356771: Allow canonical namespace names for module namespace redirects
T356600: What links here not consistent with module namespace redirects
T133266: Somebody is able to suppress redirect without permission to do that
Mentioned Here
T126308: Scribunto console is in English instead of the site language
T299279: Pages with Scribunto content model get English content language and short description
T73200: Support redirects in JavaScriptContent
T73201: Support redirects in CssContent
Duplicates Merged Here
T236607: Add support for module redirects
Event Timeline
There are a very large number of changes, so older changes are hidden.
Show Older Changes
GTrang
raised the priority of this task from
to
Needs Triage
Dec 8 2015, 2:13 AM
2015-12-08 02:13:16 (UTC+0)
GTrang
updated the task description.
(Show Details)
GTrang
added a project:
Scribunto
GTrang
subscribed.
Restricted Application
added subscribers:
StudiesWorld
Aklapper
View Herald Transcript
Dec 8 2015, 2:13 AM
2015-12-08 02:13:16 (UTC+0)
gerritbot
subscribed.
Apr 26 2016, 6:26 PM
2016-04-26 18:26:01 (UTC+0)
Comment Actions
Change 146608 had a related patch set uploaded (by Jackmcbarn):
Add redirect support to modules
gerritbot
added a project:
Patch-For-Review
Apr 26 2016, 6:26 PM
2016-04-26 18:26:02 (UTC+0)
Jackmcbarn
mentioned this in
T133266: Somebody is able to suppress redirect without permission to do that
Apr 26 2016, 6:26 PM
2016-04-26 18:26:40 (UTC+0)
Dvorapa
subscribed.
Apr 26 2016, 7:40 PM
2016-04-26 19:40:57 (UTC+0)
andymw
subscribed.
Oct 27 2016, 7:52 PM
2016-10-27 19:52:46 (UTC+0)
PerfektesChaos
subscribed.
Jul 3 2018, 1:05 PM
2018-07-03 13:05:34 (UTC+0)
Wikisaurus2
subscribed.
Nov 2 2018, 12:20 PM
2018-11-02 12:20:13 (UTC+0)
IKhitron
subscribed.
Nov 2 2018, 1:04 PM
2018-11-02 13:04:31 (UTC+0)
putnik
subscribed.
Nov 2 2018, 3:48 PM
2018-11-02 15:48:31 (UTC+0)
Bugreporter
merged a task:
T236607: Add support for module redirects
Oct 27 2019, 8:42 AM
2019-10-27 08:42:02 (UTC+0)
Bugreporter
added subscribers:
DannyS712
Masumrezarock100
Restricted Application
added a subscriber:
Liuxinyu970226
View Herald Transcript
Oct 27 2019, 8:42 AM
2019-10-27 08:42:03 (UTC+0)
isaacl
subscribed.
Feb 21 2020, 8:47 PM
2020-02-21 20:47:48 (UTC+0)
Comment Actions
Is there any update on the status of this task? This would enable renaming a deployed module seamlessly, without having to resort to a copy-and-paste move to the new module name, followed by redirecting the old module to the new one.
See
for background on the request.
DannyS712
claimed this task.
Feb 21 2020, 8:49 PM
2020-02-21 20:49:00 (UTC+0)
Restricted Application
added a project:
User-DannyS712
View Herald Transcript
Feb 21 2020, 8:49 PM
2020-02-21 20:49:00 (UTC+0)
DannyS712
moved this task from
Unsorted
to
In progress
on the
User-DannyS712
board.
Feb 21 2020, 9:06 PM
2020-02-21 21:06:32 (UTC+0)
gerritbot
added a comment.
Mar 17 2020, 6:24 PM
2020-03-17 18:24:15 (UTC+0)
Comment Actions
Change 574086 had a related patch set uploaded (by DannyS712; owner: DannyS712):
[mediawiki/extensions/Scribunto@master] Add redirects for modules
DannyS712
moved this task from
In progress
to
Awaiting review and deployment
on the
User-DannyS712
board.
Mar 17 2020, 6:24 PM
2020-03-17 18:24:27 (UTC+0)
DannyS712
added a project:
Contributors-Team
Comment Actions
Tagging editing team for code review per
Pppery
awarded a token.
Mar 30 2020, 3:53 AM
2020-03-30 03:53:43 (UTC+0)
Carn
awarded a token.
Nov 17 2020, 7:16 AM
2020-11-17 07:16:14 (UTC+0)
Carn
subscribed.
DannyS712
added a project:
User-notice
Nov 28 2020, 1:00 AM
2020-11-28 01:00:23 (UTC+0)
DannyS712
moved this task from
To Triage
to
Not ready to announce
on the
User-notice
board.
Winston_Sung
subscribed.
Dec 25 2021, 11:58 AM
2021-12-25 11:58:55 (UTC+0)
Comment Actions
Any updates?
RhinosF1
subscribed.
Dec 25 2021, 12:08 PM
2021-12-25 12:08:21 (UTC+0)
Comment Actions
As the task hasn't been updated, no.
Winston_Sung
changed the task status from
Open
to
In Progress
Apr 7 2022, 5:57 AM
2022-04-07 05:57:17 (UTC+0)
WDoranWMF
added a project:
Platform Engineering
Apr 7 2022, 6:16 PM
2022-04-07 18:16:03 (UTC+0)
WDoranWMF
edited projects, added
Platform Engineering (Icebox)
; removed
Platform Engineering
WDoranWMF
changed the task status from
In Progress
to
Stalled
Edited
Apr 7 2022, 6:18 PM
2022-04-07 18:18:26 (UTC+0)
WDoranWMF
subscribed.
Comment Actions
Just to be clear, on why I added this task to the Platform Engineering Icebox. We acknowledge the existence of this task but progress on it is unlikely. If anyone can walk through the urgency/priority that would be helpful.
Others are welcome to work on it or help to get it merged.
DannyS712
changed the task status from
Stalled
to
In Progress
Apr 7 2022, 7:19 PM
2022-04-07 19:19:23 (UTC+0)
Comment Actions
In
T120794#7839206
@WDoranWMF
wrote:
Just to be clear, on why I added this task to the Platform Engineering Icebox. We acknowledge the existence of this task but progress on it is unlikely. If anyone can walk through the urgency/priority that would be helpful.
Others are welcome to work on it or help to get it merged.
I've rebased the patch and it is ready for review - stalled is not the correct state, since it can still be worked on even if it won't be by platform engineering. Why do you say that progress is unlikely? My patch at
implements this as requested and has tests to confirm that it works, it would be really helpful for WMF communities where module page moves now require manually creating a redirect afterwards
Ahecht
awarded a token.
Apr 23 2022, 5:49 AM
2022-04-23 05:49:54 (UTC+0)
Ahecht
subscribed.
Apr 23 2022, 5:52 AM
2022-04-23 05:52:24 (UTC+0)
gerritbot
added a comment.
Sep 30 2022, 2:12 AM
2022-09-30 02:12:43 (UTC+0)
Comment Actions
Change 146608
abandoned
by Legoktm:
[mediawiki/extensions/Scribunto@master] Add redirect support to modules
Reason:
In favor of I405e7953d00af8a34d5e8addc61a245732c71e8e.
Legoktm
subscribed.
Sep 30 2022, 2:23 AM
2022-09-30 02:23:07 (UTC+0)
Comment Actions
I left feedback on the patch, the main question I have is whether we want a preceding
--[[ #REDIRECT ]]
comment like we do for JS/CSS redirects.
Rubin16
subscribed.
Sep 30 2022, 5:44 AM
2022-09-30 05:44:15 (UTC+0)
PerfektesChaos
added a comment.
Sep 30 2022, 7:07 AM
2022-09-30 07:07:15 (UTC+0)
Comment Actions
It is completely fine to add (after empty line) such comment after statement as an explanation for such stupid one line modules.
Might be followed by timestamp, if possible, to make automatic generation more obvious and to find the event faster in version history of target page.
When all the usages and links to the old page have been updated, the redirect could be deleted, and migration process has worked without any interrupt.
Legoktm
added a comment.
Oct 1 2022, 3:56 AM
2022-10-01 03:56:20 (UTC+0)
Comment Actions
In
T120794#8274692
@PerfektesChaos
wrote:
It is completely fine to add (after empty line) such comment after statement as an explanation for such stupid one line modules.
Ack.
Might be followed by timestamp, if possible, to make automatic generation more obvious and to find the event faster in version history of target page.
Interesting idea, I would like to hear others' opinions on this idea and would prefer to leave it out of the initial patch.
My current thinking is that we want it to look like:
-- #REDIRECT
return
require
"Module:Target"
Yes/no?
(If we don't hear from Danny in the next few days I'll update the patch)
Winston_Sung
added a comment.
Oct 1 2022, 4:35 AM
2022-10-01 04:35:46 (UTC+0)
Comment Actions
In
T120794#8277530
@Legoktm
wrote:
My current thinking is that we want it to look like:
-- #REDIRECT
return
require
"Module:Target"
I would prefer this format.
Also, would we like to support localized
#REDIRECT
or keep it in English?
PerfektesChaos
added a comment.
Oct 1 2022, 3:11 PM
2022-10-01 15:11:44 (UTC+0)
Comment Actions
In
T120794#8277562
@Winston_Sung
wrote:
Also, would we like to support localized
#REDIRECT
or keep it in English?
English is sufficient, since the audience are Lua programmers rather than encyclopedic authors. Lua is English.
My major concern is that someone encounters the module link and asks which bloody fool wrote a module of one silly line.
-- #REDIRECT (page move)
The idea is to detect all occurrencies even in currently inactive paths, then deleting that redirect.
Legoktm
added a comment.
Oct 1 2022, 5:39 PM
2022-10-01 17:39:48 (UTC+0)
Comment Actions
In
T120794#8277562
@Winston_Sung
wrote:
Also, would we like to support localized
#REDIRECT
or keep it in English?
Currently module pages are forced to English because as PerfektesChaos notes, Lua is English. I don't think this is the ideal behavior (see e.g.
T126308
T299279
as problems caused by this), but it is probably too much to take on here. If we do fix that, we could add localization for
#REDIRECT
afterwards, as I do disagree that "English is sufficient".
In
T120794#8277692
@PerfektesChaos
wrote:
My major concern is that someone encounters the module link and asks which bloody fool wrote a module of one silly line.
People can use the page history and figure it out pretty easily.
isaacl
added a comment.
Edited
Oct 1 2022, 9:04 PM
2022-10-01 21:04:10 (UTC+0)
Comment Actions
In
T120794#8277692
@PerfektesChaos
wrote:
In
T120794#8277562
@Winston_Sung
wrote:
Also, would we like to support localized
#REDIRECT
or keep it in English?
English is sufficient, since the audience are Lua programmers rather than encyclopedic authors. Lua is English.
My major concern is that someone encounters the module link and asks which bloody fool wrote a module of one silly line.
Given that the audience is programmers, I feel they will recognize that the module is delegating to another for its implementation.
Legoktm
added a comment.
Oct 4 2022, 11:32 PM
2022-10-04 23:32:02 (UTC+0)
Comment Actions
I ended up removing
-- #REDIRECT
after reading Anomie's earlier code review on the patch which pointed out that it wasn't necessary (like in JS/CSS) because there's no confusion with a legitimate module.
TheresNoTime
removed a subscriber:
RhinosF1
Dec 15 2022, 11:36 PM
2022-12-15 23:36:31 (UTC+0)
Uzume
subscribed.
Edited
Feb 13 2023, 9:32 AM
2023-02-13 09:32:32 (UTC+0)
Comment Actions
Using something simplistic like the proposed
return require( "Module:Target" )
can easily be detected by the target module, perhaps even affecting its functionality. Specifically,
...
will have a value during the module initialization because the module is
require
d and not directly
#invoke
d and
mw.getCurrentFrame():getTitle()
will refer to the
#invoke
d title and not the redirection target. Also reported script errors will list the
#invoke
d module in the call stack because the target module is not truly treated as the Lua "main" module.
A more complete, albeit more complex, solution would be to catch the
#invoke
function name by using an
__index
metamethod and then calling
mw.getCurrentFrame():getParent():callParserFunction('#invoke', {[[TargetModuleName]], funcname, ...})
, providing the function name and the frame args. The tricky part would be massaging the args to include the TargetModuleName and the function name caught by the
__index
metamethod as well as the frame args from
mw.getCurrentFrame().args
Something along these lines:
return
setmetatable
({},
__index
function
pkg
funcname
return
function
frame
local
pfargs
[[TargetModuleName]]
funcname
-- repack sequential args; implication: numeric parameter keys will be altered
for
in
ipairs
frame
args
do
pfargs
pfargs
end
-- copy other args; implication: accessing all the args means all their values will be expanded
for
in
pairs
frame
args
do
if
'string'
==
type
then
pfargs
end
end
return
frame
getParent
():
callParserFunction
'#invoke'
pfargs
end
end
})
Perhaps the best solution would be to add something to the Scribunto Lua API and just call that for the redirection then it could have PHP counter parts like many other parts of the Scribunto Lua API and could easily implement a
#invoke
redirection functionality which would always work and could not really be detected by any Scribunto Lua module (and thus cannot affect their functionality).
Maybe something similar to
frame:extensionTag
, which is essentially a specialized wrapper for
callParserFunction
with
#tag
, could be developed for
#invoke
allowing for the function name to be passed through in fashion like
content
is for
frame:extensionTag
. The up side of such a thing would be not needing to play with the args (which cause them to be expanded).
Another issue to consider is parsing to determine what constitutes a redirect module. There are many different Lua syntaxes that can accomplish the same thing and I imagine they would not all be detected as redirects even thought they accomplished effectively the same thing. For example even if we stick with the flawed
return require( "Module:Target" )
, I could add variable to the mix to hold the interim
require
return value. I could change the literal string format to single quotes or one of the many possible long string literal formats. I could leave out the parentheses in the
require
functional call using the single literal string functional call syntax. There are many ways such a module redirect could be modified and we need to ensure that they are still detected as a valid redirect module (in much the same way as there are many ways to modify
#REDIRECT
wikitext redirects while they are still considered redirects).
For these reasons, I believe a dedicated Scribunto API change is much preferred for introducing module redirects (e.g., providing the funcname in the frame would go a long ways but it should be possible to cause Scribunto to just punt to another module with same funcname and frame args, possibly by just having Lua run another "main" module).
Tacsipacsi
subscribed.
Sep 17 2023, 9:52 AM
2023-09-17 09:52:53 (UTC+0)
Winston_Sung
removed a project:
Contributors-Team
Oct 1 2023, 2:17 PM
2023-10-01 14:17:46 (UTC+0)
Comment Actions
Contributors-Team
is currently an archived project.
Aklapper
edited projects, added
Patch-Needs-Improvement
; removed
Patch-For-Review
Oct 2 2023, 5:25 PM
2023-10-02 17:25:48 (UTC+0)
DannyS712
removed
DannyS712
as the assignee of this task.
Oct 5 2023, 9:42 PM
2023-10-05 21:42:58 (UTC+0)
Comment Actions
I'm sorry that I haven't handled this task. I recently returned from a long bout of unexpected inactivity, and while I plan to resume my contributions here on Phabricator its unfair to claim tasks that I might not work on when others may be interested in handling them. I'm removing myself as the assignee in a batch-action, but if someone feels that I really should be the one to handle this task feel free to re-assign me and I'll take a look.
Tacsipacsi
added a comment.
Oct 6 2023, 8:14 PM
2023-10-06 20:14:30 (UTC+0)
Comment Actions
@DannyS712
You have an open Gerrit change on this, it’d be easier if you could finish it. If you can’t or don’t want to, maybe you should also abandon the change (it can always be restored), not only unassign the task.
gerritbot
added a comment.
Dec 14 2023, 4:25 AM
2023-12-14 04:25:10 (UTC+0)
Comment Actions
Change 574086
merged
by jenkins-bot:
[mediawiki/extensions/Scribunto@master] Add redirects for modules
ReleaseTaggerBot
added a project:
MW-1.42-notes (1.42.0-wmf.10; 2023-12-19)
Dec 14 2023, 7:00 AM
2023-12-14 07:00:48 (UTC+0)
Quiddity
subscribed.
Dec 14 2023, 7:07 PM
2023-12-14 19:07:37 (UTC+0)
Comment Actions
Re: Tech News - it looks like this is ready to be announced in next week's edition.
What wording and links (documentation?) would you suggest as the content? My best-guess is something like:
Changes later this week
It will be possible to redirect pages in the Module namespace, and moving a Module will leave a redirect behind.
But I'm uncertain about the wording, and can't see any existing documentation about it on mediawiki-wiki. Thanks!
Quiddity
moved this task from
Not ready to announce
to
Announce in next Tech/News
on the
User-notice
board.
Dec 14 2023, 7:08 PM
2023-12-14 19:08:08 (UTC+0)
Tacsipacsi
removed a project:
Patch-Needs-Improvement
Dec 14 2023, 9:38 PM
2023-12-14 21:38:02 (UTC+0)
Comment Actions
The first part of the sentence is not entirely correct: the construct used for redirecting modules is standard Lua code, which could always be used to “redirect” modules, but they haven’t previously been recognized as such (weren’t italic on special pages, weren’t hidden from Special:UnconnectedPages etc.), so the new thing is that one particular syntax to “redirect” modules is now recognized as a redirect (plus that moving modules will leave redirects behind).
Quiddity
added a comment.
Dec 14 2023, 9:47 PM
2023-12-14 21:47:11 (UTC+0)
Comment Actions
Specific suggestions for how to word it, and what to link to, would be greatly appreciated!
cscott
closed this task as
Resolved
Dec 15 2023, 5:32 PM
2023-12-15 17:32:53 (UTC+0)
cscott
claimed this task.
cscott
added a project:
MediaWiki CodeJam Dec 2023
cscott
added a comment.
Dec 15 2023, 5:43 PM
2023-12-15 17:43:34 (UTC+0)
Comment Actions
In
T120794#9407752
@Quiddity
wrote:
Re: Tech News - it looks like this is ready to be announced in next week's edition.
But I'm uncertain about the wording, and can't see any existing documentation about it on mediawiki-wiki. Thanks!
Added documentation at
Suggested wording:
"Full support for redirects in the Module namespace was added: the "Move Page" functionality in the sidebar will now leave an appropriate redirect behind, and such redirects are appropriately recognized (italic on special pages, hidden from Special:UnconnectedPages etc.)."
cscott
moved this task from
Incoming
to
Done / Ready for Showcase
on the
MediaWiki CodeJam Dec 2023
board.
Dec 15 2023, 5:53 PM
2023-12-15 17:53:17 (UTC+0)
Quiddity
moved this task from
Announce in next Tech/News
to
In current Tech/News draft
on the
User-notice
board.
Dec 15 2023, 10:19 PM
2023-12-15 22:19:59 (UTC+0)
Frostly
moved this task from
In current Tech/News draft
to
Already announced/Archive
on the
User-notice
board.
Dec 18 2023, 4:42 PM
2023-12-18 16:42:52 (UTC+0)
SunAfterRain
subscribed.
Dec 18 2023, 5:00 PM
2023-12-18 17:00:42 (UTC+0)
Comment Actions
Two questions:
Should the redirect page use design similar to a general redirect indicating that this is a redirect instead of continuing to use
scribunto-doc-page-does-not-exist
scribunto-doc-page-show
Does not support any syntax that is different from
return require [[Module:Target]]
(even if the number of spaces is different
return require[[Module:Target]]
, or quote
return require "Module:Target"
, etc.) is a "feature" of this new functionality?
Winston_Sung
added a comment.
Dec 18 2023, 5:34 PM
2023-12-18 17:34:42 (UTC+0)
Comment Actions
In
T120794#9413572
@SunAfterRain
wrote:
Does not support any syntax that is different from
return require [[Module:Target]]
(even if the number of spaces is different
return require[[Module:Target]]
, or quote
return require "Module:Target"
, etc.) is a "feature" of this new functionality?
In
we might as well keep it a strict check, we can loosen it later if we feel it's best.
making it lenient in a future patch is okay
Maintenance_bot
edited projects, added
User-notice-archive
; removed
User-notice
Dec 28 2023, 6:30 PM
2023-12-28 18:30:21 (UTC+0)
Bean49
subscribed.
Feb 3 2024, 1:17 PM
2024-02-03 13:17:38 (UTC+0)
Comment Actions
Only local namespace name is supported like "Modul" on huwiki. Please allow canonical namespace name too, like "Module".
Winston_Sung
added a comment.
Feb 4 2024, 4:17 PM
2024-02-04 16:17:02 (UTC+0)
Comment Actions
In
T120794#9511173
@Bean49
wrote:
Only local namespace name is supported like "Modul" on huwiki. Please allow canonical namespace name too, like "Module".
Could you provide an example URL?
Winston_Sung
added a comment.
Feb 4 2024, 4:20 PM
2024-02-04 16:20:38 (UTC+0)
Comment Actions
Oh, this one?
Winston_Sung
added a comment.
Edited
Feb 4 2024, 4:35 PM
2024-02-04 16:35:30 (UTC+0)
Comment Actions
Caused by
includes/Engines/LuaCommon/LuaEngine.php#1006
if
$content
->
equals
$this
->
makeRedirectContent
$title
which require an exact match.
Bean49
mentioned this in
T356600: What links here not consistent with module namespace redirects
Feb 4 2024, 8:23 PM
2024-02-04 20:23:22 (UTC+0)
Bean49
added a comment.
Feb 4 2024, 8:28 PM
2024-02-04 20:28:39 (UTC+0)
Comment Actions
In
T120794#9511825
@Winston_Sung
wrote:
Oh, this one?
Yes. Should I create a new task?
Winston_Sung
added a comment.
Feb 6 2024, 10:54 AM
2024-02-06 10:54:42 (UTC+0)
Comment Actions
In
T120794#9511906
@Bean49
wrote:
Yes. Should I create a new task?
Yeah. File a Software Feature task.
Bean49
mentioned this in
T356771: Allow canonical namespace names for module namespace redirects
Feb 6 2024, 1:10 PM
2024-02-06 13:10:28 (UTC+0)
Uzume
added a comment.
Feb 22 2024, 6:30 PM
2024-02-22 18:30:48 (UTC+0)
Comment Actions
It seems to me a superior solution would just be to use the existing wikitext redirects (necessitating a change in the content model upon rename/moves) and have Scribunto fetch the targets of such things before it #invokes, requires, etc.
Of course there is still the issue to potentially moving across namespaces but I am sure that could be restricted somehow.
Log In to Comment
Content licensed under Creative Commons Attribution-ShareAlike (CC BY-SA) 4.0 unless otherwise noted; code licensed under GNU General Public License (GPL) 2.0 or later and other open source licenses. By using this site, you agree to the Terms of Use, Privacy Policy, and Code of Conduct.
Wikimedia Foundation
Code of Conduct
Disclaimer
CC-BY-SA
GPL
Credits
US