Module:High-use: Difference between revisions
no edit summary
Nazarzadeh (talk | contribs) m (1 revision imported) |
No edit summary |
||
Line 18: | Line 18: | ||
if count == nil then | if count == nil then | ||
if frame.args[1] == "risk" then | if frame.args[1] == "risk" then | ||
return "a very large number of" | |||
else | else | ||
return "many" | |||
end | end | ||
else | else | ||
Line 55: | Line 55: | ||
-- Actions if there is a large (greater than or equal to 100,000) transclusion count | -- Actions if there is a large (greater than or equal to 100,000) transclusion count | ||
function p.risk(frame) | function p.risk(frame) | ||
if frame.args[1] == "risk" then | if frame.args[1] == "risk" then | ||
return "risk" | |||
else | else | ||
local count = _fetch(frame) | local count = _fetch(frame) | ||
if count and count >= 100000 then | if count and count >= 100000 then | ||
return "risk" | |||
end | |||
end | end | ||
return | return "" | ||
end | end | ||
Line 87: | Line 88: | ||
end | end | ||
-- This retrieves the project URL automatically to simplify | -- This retrieves the project URL automatically to simplify localization. | ||
local templateCount = ('on [https://linkcount.toolforge.org/ | local templateCount = ('on [https://linkcount.toolforge.org/?project=%s&page=%s#transclusions %s pages]'):format( | ||
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'), | mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'), | ||
mw.uri.encode(title.fullText), p.num(frame, count)) | mw.uri.encode(title.fullText), p.num(frame, count)) | ||
Line 147: | Line 148: | ||
local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] | local nocat = frame:getParent().args['nocat'] or frame.args['nocat'] | ||
local categorise = (nocat == '' or not yesno(nocat)) | local categorise = (nocat == '' or not yesno(nocat)) | ||
if categorise then | if categorise and not mw.title.getCurrentTitle().isRedirect then | ||
epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}') | epilogue = frame:preprocess('{{Sandbox other||{{#switch:{{#invoke:Effective protection level|{{#switch:{{NAMESPACE}}|File=upload|#default=edit}}|{{FULLPAGENAME}}}}|sysop|templateeditor|interfaceadmin=|#default=[[Category:Pages used in system messages needing protection]]}}}}') | ||
end | end |