summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-18 20:08:58 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-18 20:08:58 +0000
commit84b63e040c4dd3f55aafc6089b36cbe1066a58f7 (patch)
tree9451edbd515312521fa0085949b00025e960775d
parentd63c6695c768b9cf893eb7f0f22a8078b4df3b86 (diff)
downloadacf-clamav-84b63e040c4dd3f55aafc6089b36cbe1066a58f7.tar.bz2
acf-clamav-84b63e040c4dd3f55aafc6089b36cbe1066a58f7.tar.xz
Remove all calls to 'module' in preparation for move to Lua 5.2
Use mymodule parameter for module definition. This was also helpful in revealing places where the code relied on the global environment.
-rw-r--r--clamav-controller.lua18
-rw-r--r--clamav-model.lua20
2 files changed, 21 insertions, 17 deletions
diff --git a/clamav-controller.lua b/clamav-controller.lua
index dcce6e5..ee54309 100644
--- a/clamav-controller.lua
+++ b/clamav-controller.lua
@@ -1,27 +1,29 @@
-module(..., package.seeall)
+local mymodule = {}
-default_action = "status"
+mymodule.default_action = "status"
-function status(self)
+function mymodule.status(self)
return self.model.getstatus()
end
-function startstop(self)
+function mymodule.startstop(self)
return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end
-function details(self)
+function mymodule.details(self)
return self.model.getstatusdetails()
end
-function listfiles(self)
+function mymodule.listfiles(self)
return self.model.getfilelist()
end
-function expert(self)
+function mymodule.expert(self)
return self.handle_form(self, self.model.getfiledetails, self.model.updatefiledetails, self.clientdata, "Save", "Edit ClamAV File", "File Saved")
end
-function logfile(self)
+function mymodule.logfile(self)
return self.model.getlogfile()
end
+
+return mymodule
diff --git a/clamav-model.lua b/clamav-model.lua
index d83484d..c1e1d2a 100644
--- a/clamav-model.lua
+++ b/clamav-model.lua
@@ -1,4 +1,4 @@
-module(..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -18,23 +18,23 @@ local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
-- ################################################################################
-- PUBLIC FUNCTIONS
-function get_startstop(self, clientdata)
+function mymodule.get_startstop(self, clientdata)
return modelfunctions.get_startstop(processname)
end
-function startstop_service(self, startstop, action)
+function mymodule.startstop_service(self, startstop, action)
return modelfunctions.startstop_service(startstop, action)
end
-function getstatus()
+function mymodule.getstatus()
return modelfunctions.getstatus(processname, packagename, "ClamAV Status")
end
-function getstatusdetails()
+function mymodule.getstatusdetails()
return cfe({ type="longtext", value="", label="ClamAV Status Details" })
end
-function getfilelist()
+function mymodule.getfilelist()
local listed_files = {}
for i,name in ipairs(filelist) do
@@ -47,15 +47,15 @@ function getfilelist()
return cfe({ type="list", value=listed_files, label="ClamAV File List" })
end
-function getfiledetails(self, clientdata)
+function mymodule.getfiledetails(self, clientdata)
return modelfunctions.getfiledetails(clientdata.filename, filelist)
end
-function updatefiledetails(self, filedetails)
+function mymodule.updatefiledetails(self, filedetails)
return modelfunctions.setfiledetails(self, filedetails, filelist)
end
-function getlogfile ()
+function mymodule.getlogfile ()
local files = {}
local logfilepath = format.parse_configfile(fs.read_file(filelist[1]) or "").LogFile
if not logfilepath then
@@ -71,3 +71,5 @@ function getlogfile ()
end
return cfe({ value=files, label="ClamAV logfiles" })
end
+
+return mymodule