Jump to content

Module:SPI archive notice

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Dreamy Jazz (talk | contribs) at 17:33, 13 February 2022 (fix). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local mRedirect = require('Module:Redirect')
local getArgs = require('Module:Arguments').getArgs

local p = {}

function p.checkIfSPIMayNeedRename(frame)
	local args = getArgs(frame)
	if (p._checkIfSPIMayNeedRename(args)) then
		return 'yes'
	else
		return 'no'	
	end
end

function p._checkIfSPIMayNeedRename(args)
	if (mw.title.new(args[1]):getContent() == nil) then
		return true
	else
		local redirectTarget = mRedirect.getTarget(args[1])
		if (redirectTarget ~= nil) then
			if (mw.ustring.find(redirectTarget, '^User:' .. args[1]) or mw.ustring.find(redirectTarget, '^User talk:' .. args[1])) then
				return false
			else
				return true
			end
		else
			return false	
		end
	end
end

return p