From db73e37e2d9261a1ec27964ee453f7c59312af79 Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sat, 15 Mar 2014 20:33:34 +0100 Subject: Created a small plugin for InfoDump It allows you to dump the info of a plugin by pressing a button in the webadmin. --- MCServer/Plugins/DumpInfo/Init.lua | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 MCServer/Plugins/DumpInfo/Init.lua (limited to 'MCServer/Plugins/DumpInfo/Init.lua') diff --git a/MCServer/Plugins/DumpInfo/Init.lua b/MCServer/Plugins/DumpInfo/Init.lua new file mode 100644 index 000000000..0fa542bb8 --- /dev/null +++ b/MCServer/Plugins/DumpInfo/Init.lua @@ -0,0 +1,49 @@ +function Initialize(a_Plugin) + a_Plugin:SetName("DumpInfo") + a_Plugin:SetVersion(1) + + -- Check if the infodump file exists. + if (not cFile:Exists("Plugins/InfoDump.lua")) then + LOGWARN("[DumpInfo] InfoDump.lua was not found.") + return false + end + + -- Add the webtab. + a_Plugin:AddWebTab("DumpPlugin", HandleDumpPluginRequest) + return true +end + + + + + +function HandleDumpPluginRequest(a_Request) + local Content = "" + + -- Check if it already was requested to dump a plugin. + if (a_Request.PostParams["DumpInfo"] ~= nil) then + local F = loadfile("Plugins/InfoDump.lua") + F("Plugins/" .. a_Request.PostParams["DumpInfo"]) + end + + Content = Content .. [[ + +]] + + -- Loop through each plugin that is found. + for PluginName, k in pairs(cPluginManager:Get():GetAllPlugins()) do + + -- Check if there is a file called 'Info.lua' or 'info.lua' + if (cFile:Exists("Plugins/" .. PluginName .. "/Info.lua") or cFile:Exists("Plugins/" .. PluginName .. "/info.lua")) then + Content = Content .. "" + Content = Content .. "" + Content = Content .. "" + end + end + + Content = Content .. [[ +
DumpInfo
" .. PluginName .. "
" + Content = Content .. "
]] + + return Content +end -- cgit v1.2.3 From 5a9f17060d09316931fd246e7b5f059a6bf4abac Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 16 Mar 2014 21:52:28 +0100 Subject: Only check for "Info.lua" with capital I --- MCServer/Plugins/DumpInfo/Init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MCServer/Plugins/DumpInfo/Init.lua') diff --git a/MCServer/Plugins/DumpInfo/Init.lua b/MCServer/Plugins/DumpInfo/Init.lua index 0fa542bb8..5d9c752b0 100644 --- a/MCServer/Plugins/DumpInfo/Init.lua +++ b/MCServer/Plugins/DumpInfo/Init.lua @@ -34,7 +34,7 @@ function HandleDumpPluginRequest(a_Request) for PluginName, k in pairs(cPluginManager:Get():GetAllPlugins()) do -- Check if there is a file called 'Info.lua' or 'info.lua' - if (cFile:Exists("Plugins/" .. PluginName .. "/Info.lua") or cFile:Exists("Plugins/" .. PluginName .. "/info.lua")) then + if (cFile:Exists("Plugins/" .. PluginName .. "/Info.lua")) then Content = Content .. "" Content = Content .. "" .. PluginName .. "" Content = Content .. "
" -- cgit v1.2.3