Module:Protection banner: Difference between revisions

Flagging WP:PIA pages for arbitration enforcement via Special:AbuseFilter/1339
m 1 revision imported: Content from Template:Location Map on Wikipedia
 
(4 intermediate revisions by 3 users not shown)
Line 323: Line 323:


function Protection:isIncorrect()
function Protection:isIncorrect()
local expiry = self.expiry
if not self:shouldHaveProtectionCategory() then
return not self:shouldHaveProtectionCategory()
return true
or type(expiry) == 'number' and expiry < os.time()
end
if type(self.expiry) ~= 'number' then
return false
end
local expiry = os.date('*t', self.expiry)
-- Avoid checking today.day or os.time(), unless close. https://phabricator.wikimedia.org/T416616
local today = os.date('*t')
return (expiry.year < today.year)
or (expiry.year == today.year and expiry.month < today.month)
or (expiry.year == today.year and expiry.month == today.month and expiry.day < today.day)
or (expiry.year == today.year and expiry.month == today.month and expiry.day == today.day and self.expiry < os.time())
end
end


Line 870: Line 880:
if protectionObj.level == "extendedconfirmed" then
if protectionObj.level == "extendedconfirmed" then
if require("Module:TableTools").inArray(protectionObj.title.talkPageTitle.categories, "Wikipedia pages subject to the extended confirmed restriction related to the Arab-Israeli conflict") then
if require("Module:TableTools").inArray(protectionObj.title.talkPageTitle.categories, "Wikipedia pages subject to the extended confirmed restriction related to the Arab-Israeli conflict") then
ret[#ret + 1] = "<p class='PIA-flag' style='display:none; visibility:hidden;'>This page is subject to the extended confirmed restriction related to the Arab-Israeli conflict.</p>"
ret[#ret + 1] = "<p class='PIA-flag' style='display:none; visibility:hidden;' title='This page is subject to the extended confirmed restriction related to the Arab-Israeli conflict.'></p>"
end
end
end
end