Module:Maintainers

-- 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-core-platform-team"] = "Core Platform Team", ["steward-growth"] = "Growth Team", ["steward-performance-team"] = "Performance Team", ["maintainedby"] = "Maintained by $1.", ["livechat"] = "Live chat (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", },	["core-platform-team"] = { namekey = "steward-core-platform-team", irc = "mediawiki-core", },	["growth"] = { namekey = "steward-growth", irc = "wikimedia-collaboration", },	["performance-team"] = { namekey = "steward-performance-team", irc = "wikimedia-perf", }, } 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 = "core-platform-team", phab = "MediaWiki-API", },	["mediawiki-auth"] = { steward = "core-platform-team", phab = "mediawiki-auth", },	["mediawiki-blocks"] = { steward = "anti-harassment", phab = "MediaWiki-Blocks", },	["mediawiki-core-snapshots"] = { steward = "core-platform-team", phab = "MediaWiki-Core-Snapshots", },	["mediawiki-core-http-cache"] = { steward = "performance-team", phab = "MediaWiki-Core-HTTP-Cache", },	["mediawiki-core-poolcounter"] = { steward = "performance-team", phab = "PoolCounter", },	["mediawiki-comment-store"] = { steward = "core-platform-team", phab = "MediaWiki-Comment-Store", },	["mediawiki-configuration"] = { steward = "core-platform-team", phab = "MediaWiki-Configuration", },	["mediawiki-contenthandler"] = { steward = "core-platform-team", phab = "MediaWiki-ContentHandler", },	["mediawiki-jobqueue"] = { steward = "core-platform-team", phab = "MediaWiki-Core-JobQueue", },	["mediawiki-redirects"] = { phab = "MediaWiki-redirects", },	["mediawiki-interface"] = { phab = "MediaWiki-Interface", },	["mediawiki-page-deletion"] = { steward = "core-platform-team", phab = "MediaWiki-Page-deletion", },

-- MediaWiki extensions and skins ["navigationtiming"] = { steward = "performance-team", phab = "MediaWiki-extensions-NavigationTiming", },	["wikilambda"] = { steward = "abstract-wikipedia", phab = "wikilambda", },

-- Libraries ["at-ease"] = { steward = "performance-team", phab = "at-ease", },	["cdb"] = { steward = "performance-team", phab = "wikimedia-cdb", },	["objectcache"] = { steward = "performance-team", phab = "MediaWiki-libs-ObjectCache", },	["relpath"] = { steward = "performance-team", phab = "MediaWiki-ResourceLoader", },	["resourceloader"] = { steward = "performance-team", phab = "MediaWiki-ResourceLoader", },	["rdbms"] = { steward = "performance-team", phab = "Wikimedia-Rdbms", },	["runningstat"] = { steward = "performance-team", phab = "runningstat", },	["scopedcallback"] = { steward = "performance-team", phab = "scopedcallback", },	["timestamp"] = { steward = "performance-team", phab = "Wikimedia-Timestamp", },	["waitconditionloop"] = { steward = "performance-team", phab = "waitconditionloop", },	["wrappedstring"] = { steward = "performance-team", phab = "WrappedString", }, }

-- 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 "?" 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 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