Module:High-use: Difference between revisions

m
1 revision imported
mp>Trappist the monk
No edit summary
m (1 revision imported)
 
(8 intermediate revisions by 5 users not shown)
Line 52: Line 52:
return return_value
return return_value
end
end
-- 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)
Line 85: Line 86:
systemMessages = nil
systemMessages = nil
end
end
local templateCount = ('on [https://templatecount.toolforge.org/index.php?lang=en&namespace=%s&name=%s %s pages]'):format(
-- This retrieves the project URL automatically to simplify localiation.
mw.title.getCurrentTitle().namespace, mw.uri.encode(title.text), p.num(frame, count))
local templateCount = ('on [https://linkcount.toolforge.org/index.php?project=%s&page=%s %s pages]'):format(
mw.title.getCurrentTitle():fullUrl():gsub('//(.-)/.*', '%1'),
mw.uri.encode(title.fullText), p.num(frame, count))
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
local used_on_text = "'''This " .. (mw.title.getCurrentTitle().namespace == 828 and "Lua module" or "template") .. ' is used ';
if systemMessages then
if systemMessages then
used_on_text = used_on_text .. systemMessages ..
used_on_text = used_on_text .. systemMessages ..
((count and count > 2000) and (",''' and " .. templateCount) or ("'''"))
((count and count > 2000) and ("''', and " .. templateCount) or ("'''"))
else
else
used_on_text = used_on_text .. templateCount .. "'''"
used_on_text = used_on_text .. templateCount .. "'''"