Changes
add PC detection, from sandbox
-- Returns the permission required to perform a given action on a given title.
-- If no title is specified, the title of the page being displayed is used.
function p.main(action, pagename, frame) local if not frame then frame = mw.getCurrentFrame() end
local title
if type(pagename) == 'table' then
title = mw.title.new(pagename) or mw.title.getCurrentTitle()
end
if action == 'autoreview' then local level = frame:callParserFunction('PENDINGCHANGELEVEL', pagename) if level == 'review' then return 'reviewer' elseif level ~= '' then return level else return nil -- not '*'. a page not being PC-protected is distinct from it being PC-protected with anyone able to review. also not '', as that would mean PC-protected but nobody can review end elseif action ~= 'edit' and action ~= 'move' and action ~= 'create' and action ~= 'upload' then error( 'First parameter must be one of edit, move, create, upload, autoreview', 2 )
end
if title.namespace == 8 then -- MediaWiki namespace
end
-- Make this the protection function usable from wikitext rather than just other lua modules
function p.p(frame)
local parent args = frame.args local pargs = frame:getParent().args return p.main(parentargs.action or args[1] or pargs.action or parent.argspargs[1], parentargs.title or args[2] or pargs.title or parent.argspargs[2], frame)
end
return p