summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2013-10-20 00:29:36 +0000
committerTed Trask <ttrask01@yahoo.com>2013-10-20 00:29:36 +0000
commit707b80c58b537cff83998d73d6198c539a082db8 (patch)
tree98822040db7897efe1136085b05eb456fba0e642
parent9b04484f19bac8666c9cea39480a8385ed2f23da (diff)
downloadacf-lighttpd-707b80c58b537cff83998d73d6198c539a082db8.tar.bz2
acf-lighttpd-707b80c58b537cff83998d73d6198c539a082db8.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--lighttpd-controller.lua16
-rw-r--r--lighttpd-model.lua18
2 files changed, 19 insertions, 15 deletions
diff --git a/lighttpd-controller.lua b/lighttpd-controller.lua
index 9cd8240..c6ff50a 100644
--- a/lighttpd-controller.lua
+++ b/lighttpd-controller.lua
@@ -1,23 +1,25 @@
-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 listfiles(self)
+function mymodule.listfiles(self)
return self.model.getfilelist()
end
-function expert(self)
+function mymodule.expert(self)
return self.handle_form(self, function() return self.model.getfiledetails(self.clientdata.filename) end, self.model.updatefiledetails, self.clientdata, "Save", "Edit Lighttpd File", "File Saved")
end
-function logfile(self)
+function mymodule.logfile(self)
return self.model.getlogfile()
end
+
+return mymodule
diff --git a/lighttpd-model.lua b/lighttpd-model.lua
index 32a9b94..303c980 100644
--- a/lighttpd-model.lua
+++ b/lighttpd-model.lua
@@ -1,4 +1,4 @@
-module(..., package.seeall)
+local mymodule = {}
-- Load libraries
modelfunctions = require("modelfunctions")
@@ -18,19 +18,19 @@ 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, "Lighttpd Status")
end
-function getfilelist()
+function mymodule.getfilelist()
local listed_files = {}
for i,name in ipairs(filelist) do
@@ -43,15 +43,15 @@ function getfilelist()
return cfe({ type="list", value=listed_files, label="Lighttpd File List" })
end
-function getfiledetails(filename)
+function mymodule.getfiledetails(filename)
return modelfunctions.getfiledetails(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
@@ -67,3 +67,5 @@ function getlogfile ()
end
return cfe({ value=files, label="Lighttpd logfiles" })
end
+
+return mymodule