Module:Maintainers
From Linux Web Expert
Example
Information
The following:
{{#invoke:Maintainers|info|MediaWiki-API}}
.. renders as:
- Maintained by MediaWiki Interfaces Team.
- Live chat (IRC): <span class="plainlinks" style="font-family: monospace,Courier; white-space: pre-wrap !important; word-wrap: break-word; max-width: 1200px; overflow: auto;" title="<translate nowrap> <tvar name=1>#mediawiki-core</tvar> on Libera.Chat IRC</translate>">#mediawiki-core <translate> connect</translate>
- Issue tracker: Phabricator MediaWiki-Action-API (Report an issue)
Link stewardship
The following:
{{#invoke:Maintainers|link_stewardship|MediaWiki-API}}
.. renders as:
Link issue tracker
The following:
{{#invoke:Maintainers|link_issues|MediaWiki-API}}
.. renders as:
See also
-- Component information table
--
local i18n = {
-- Internationalization table.
--
-- Note that these strings are not actually used.
-- They are overridden by [[Template:Component]] and translates there,
-- thus breaking changes should be avoided (add new parameters, don't re-order
-- or remove until after the template is updated, translation-approved such
-- that translations are invalidated).
["steward-abstract-wikipedia"] = "[[Abstract Wikipedia team]]",
["steward-anti-harassment"] = "[[Anti-Harassment Tools]]",
["steward-content-transform-team"] = "[[Content Transform Team]]",
["steward-growth"] = "[[Growth|Growth Team]]",
["steward-mediawiki-interfaces-team"] = "[[MediaWiki Interfaces Team]]",
["steward-mediawiki-platform-team"] = "[[MediaWiki Platform Team]]",
["steward-releng"] = "[[Wikimedia Release Engineering Team|Release Engineering Team]]",
["maintainedby"] = "Maintained by $1.",
["livechat"] = "Live chat ([[Special:MyLanguage/MediaWiki on IRC|IRC]]): $1",
["issuetracker"] = "Issue tracker: [$1 Phabricator $3] ([$2 Report an issue])",
}
local stewards = {
-- Format:
--
-- [key]: Lowercase steward ID. (used in the 'maintainers' table below)
-- namekey: Key in the above i18n table that contains the linked name of the steward. (optional)
-- irc: Name of Libera Chat IRC channel, without leading hash. (optional)
--
["abstract-wikipedia"] = {
namekey = "steward-abstract-wikipedia",
irc = "wikipedia-abstract-tech",
},
["anti-harassment"] = {
namekey = "steward-anti-harassment",
},
["content-transform-team"] = {
namekey = "steward-content-transform-team",
irc = "mediawiki-core",
},
["growth"] = {
namekey = "steward-growth",
irc = "wikimedia-collaboration",
},
["mediawiki-interfaces-team"] = {
namekey = "steward-mediawiki-interfaces-team",
irc = "mediawiki-core",
},
["mediawiki-platform-team"] = {
namekey = "steward-mediawiki-platform-team",
irc = "mediawiki-core",
},
["releng"] = {
namekey = "steward-releng",
irc = "wikimedia-releng",
},
}
local maintainers = {
-- Format:
--
-- [key]: Lowercase component ID. (used from [[Template:Component]])
-- steward: Key to 'stewards' lookup table above. (optional)
-- phab: Name of Phabricator tag. (optional)
--
-- MediaWiki core components
["mediawiki-api"] = {
steward = "mediawiki-interfaces-team",
phab = "MediaWiki-Action-API",
},
["mediawiki-auth"] = {
steward = "mediawiki-platform-team",
phab = "mediawiki-auth",
},
["mediawiki-blocks"] = {
steward = "anti-harassment",
phab = "MediaWiki-Blocks",
},
["mediawiki-core-snapshots"] = {
-- steward = formerly core-platform-team
phab = "MediaWiki-Core-Snapshots",
},
["mediawiki-core-http-cache"] = {
-- steward = formerly core-platform-team
phab = "MediaWiki-Core-HTTP-Cache",
},
["mediawiki-core-poolcounter"] = {
steward = "mediawiki-platform-team",
phab = "PoolCounter",
},
["mediawiki-core-profiler"] = {
steward = "mediawiki-platform-team",
phab = "MediaWiki-Core-Profiler",
},
["mediawiki-comment-store"] = {
-- steward = formerly core-platform-team
phab = "MediaWiki-Comment-Store",
},
["mediawiki-configuration"] = {
-- steward = formerly core-platform-team
phab = "MediaWiki-Configuration",
},
["mediawiki-contenthandler"] = {
-- steward = formerly core-platform-team
phab = "MediaWiki-ContentHandler",
},
["mediawiki-jobqueue"] = {
steward = "mediawiki-interfaces-team",
phab = "MediaWiki-Core-JobQueue",
},
["mediawiki-redirects"] = {
phab = "MediaWiki-redirects",
},
["resourceloader"] = {
steward = "mediawiki-platform-team",
phab = "MediaWiki-ResourceLoader",
},
["mediawiki-interface"] = {
phab = "MediaWiki-Interface",
},
["mediawiki-page-deletion"] = {
steward = "mediawiki-interfaces-team",
phab = "MediaWiki-Page-deletion",
},
-- MediaWiki extensions and skins
["navigationtiming"] = {
-- steward = formerly performance-team
phab = "MediaWiki-extensions-NavigationTiming",
},
["wikilambda"] = {
steward = "abstract-wikipedia",
phab = "wikilambda",
},
-- Libraries
["at-ease"] = {
-- steward = formerly performance-team
phab = "at-ease",
},
["benchmarker"] = {
steward = "mediawiki-platform-team",
phab = "MediaWiki-Core-Benchmarker",
},
["bagostuff"] = {
steward = "mediawiki-platform-team",
phab = "MediaWiki-libs-ObjectCache",
},
["cdb"] = {
-- steward = formerly performance-team
phab = "wikimedia-cdb",
},
["cssjanus"] = {
steward = "mediawiki-platform-team",
phab = "CSSJanus",
},
["excimer"] = {
steward = "mediawiki-platform-team",
phab = "Excimer",
},
["relpath"] = {
steward = "mediawiki-platform-team",
phab = "MediaWiki-ResourceLoader",
},
["rdbms"] = {
steward = "mediawiki-interfaces-team",
phab = "Wikimedia-Rdbms",
},
["runningstat"] = {
-- steward = formerly performance-team
phab = "runningstat",
},
["scopedcallback"] = {
-- steward = formerly performance-team
phab = "scopedcallback",
},
["timestamp"] = {
-- steward = formerly performance-team
phab = "Wikimedia-Timestamp",
},
["waitconditionloop"] = {
-- steward = formerly performance-team
phab = "waitconditionloop",
},
["wrappedstring"] = {
steward = "mediawiki-platform-team",
phab = "WrappedString",
},
-- Services, tools, misc
["fresh"] = {
steward = "releng",
phab = "Fresh",
},
}
-- Set translated strings from parameters in the above i18n table.
local function setI18n( args )
for n, _ in pairs( i18n ) do
if args[ "i18n-" .. n ] then
i18n[ n ] = args[ "i18n-" .. n ]
end
end
end
-- Get a translated string from the above i18n table, with optional parameter substitution.
local function msg( name, ... )
if i18n[ name ] then
return mw.message.newRawMessage( i18n[ name ], ... ):plain()
else
return nil
end
end
-- Lua methods to access the above information.
local function get_steward_link( key )
local steward = maintainers[ key ] and maintainers[ key ].steward or "?"
local link = stewards[ steward ] and i18n[ stewards[ steward ].namekey ] or '<span style="color:#72777d">Unknown or Unassigned<sup>[‍[[Developers/Maintainers|Maintainers page]]]</sup></span>'
return link
end
local function get_irc_channel( key )
local steward = maintainers[ key ] and maintainers[ key ].steward or "?"
return stewards[ steward ] and stewards[ steward ].irc or nil
end
-- Exported lua module
local p = {}
function p.link_stewardship( frame )
local key = string.lower( frame.args[1] )
return get_steward_link( key )
end
function p.link_issues( frame )
local key = string.lower( frame.args[1] )
local phab = maintainers[ key ] and maintainers[ key ].phab
if phab then
local phabencoded = mw.uri.encode( string.lower( phab ) )
return "[https://phabricator.wikimedia.org/tag/"
.. phabencoded
.. "/ Phabricator]"
end
return ""
end
function p.info( frame )
setI18n( frame.args )
local key = mw.text.trim( string.lower( frame.args[1] ) )
local line = "* " .. msg( "maintainedby", get_steward_link( key ) )
local irc_channel = get_irc_channel( key )
if irc_channel then
-- Invoke {{irc|1= $irc_channel }}
line = line .. "\n* " .. msg( "livechat", frame:expandTemplate{ title = 'irc', args = { irc_channel } } )
end
local phab = maintainers[ key ] and maintainers[ key ].phab
if phab then
local phabencoded = mw.uri.encode( string.lower( phab ) )
line = line .. "\n* " .. msg( "issuetracker",
"https://phabricator.wikimedia.org/tag/" .. phabencoded .. "/",
"https://phabricator.wikimedia.org/maniphest/task/edit/form/1/?projects=" .. phabencoded,
phab
)
end
return line
end
return p