Module:Lua banner: Difference between revisions
Content added Content deleted
m (Changed protection level for "Module:Lua banner": match template protection ([Edit=Require template editor access] (indefinite))) |
(sync with sandbox to add a tracking category) |
||
Line 1: | Line 1: | ||
-- This module implements the {{lua}} template. |
-- This module implements the {{lua}} template. |
||
local yesno = require('Module:Yesno') |
local yesno = require('Module:Yesno') |
||
local mList = require('Module:List') |
local mList = require('Module:List') |
||
Line 81: | Line 80: | ||
end |
end |
||
cats[#cats + 1] = category |
cats[#cats + 1] = category |
||
local protLevels = { |
|||
autoconfirmed = 1, |
|||
extendedconfirmed = 2, |
|||
templateeditor = 3, |
|||
sysop = 4 |
|||
} |
|||
local currentProt = titleObj.protectionLevels["edit"][1] |
|||
if currentProt == nil then currentProt = 0 else currentProt = protLevels[currentProt] end |
|||
for i, module in ipairs(modules) do |
|||
local moduleProt = mw.title.new(module).protectionLevels["edit"][1] |
|||
if moduleProt == nil then moduleProt = 0 else moduleProt = protLevels[moduleProt] end |
|||
if moduleProt < currentProt then |
|||
cats[#cats + 1] = "Templates using under-protected Lua modules" |
|||
break |
|||
end |
|||
end |
|||
end |
end |
||