summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/web/luasrc')
-rw-r--r--libs/web/luasrc/dispatcher.lua13
-rw-r--r--libs/web/luasrc/sauth.lua21
-rw-r--r--libs/web/luasrc/template.lua10
3 files changed, 20 insertions, 24 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 8fddf02122..37008b5946 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -25,7 +25,7 @@ limitations under the License.
]]--
--- LuCI web dispatcher.
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local sys = require "luci.sys"
local init = require "luci.init"
local util = require "luci.util"
@@ -394,19 +394,16 @@ end
function createindex_plain(path, suffixes)
local controllers = { }
for _, suffix in ipairs(suffixes) do
- controllers = util.combine(
- controllers,
- luci.fs.glob(path .. "*" .. suffix) or {},
- luci.fs.glob(path .. "*/*" .. suffix) or {}
- )
+ nixio.util.consume((fs.glob(path .. "*" .. suffix)), controllers)
+ nixio.util.consume((fs.glob(path .. "*/*" .. suffix)), controllers)
end
if indexcache then
- local cachedate = fs.mtime(indexcache)
+ local cachedate = fs.stat(indexcache, "mtime")
if cachedate then
local realdate = 0
for _, obj in ipairs(controllers) do
- local omtime = fs.mtime(path .. "/" .. obj)
+ local omtime = fs.stat(path .. "/" .. obj, "mtime")
realdate = (omtime and omtime > realdate) and omtime or realdate
end
diff --git a/libs/web/luasrc/sauth.lua b/libs/web/luasrc/sauth.lua
index e5cb178459..8ae24a5411 100644
--- a/libs/web/luasrc/sauth.lua
+++ b/libs/web/luasrc/sauth.lua
@@ -15,7 +15,6 @@ $Id$
--- LuCI session library.
module("luci.sauth", package.seeall)
-require("luci.fs")
require("luci.util")
require("luci.sys")
require("luci.config")
@@ -30,17 +29,17 @@ sessiontime = tonumber(luci.config.sauth.sessiontime) or 15 * 60
--- Manually clean up expired sessions.
function clean()
local now = os.time()
- local files = luci.fs.dir(sessionpath)
+ local files = fs.dir(sessionpath)
if not files then
return nil
end
- for i, file in pairs(files) do
+ for file in files do
local fname = sessionpath .. "/" .. file
- local stat = luci.fs.stat(fname)
+ local stat = fs.stat(fname)
if stat and stat.type == "reg" and stat.mtime + sessiontime < now then
- luci.fs.unlink(fname)
+ fs.unlink(fname)
end
end
end
@@ -68,8 +67,8 @@ function read(id)
if not sane(sessionpath .. "/" .. id) then
return
end
- luci.fs.utime(sessionpath .. "/" .. id)
- return luci.fs.readfile(sessionpath .. "/" .. id)
+ fs.utimes(sessionpath .. "/" .. id)
+ return fs.readfile(sessionpath .. "/" .. id)
end
@@ -77,8 +76,8 @@ end
-- @return Boolean status
function sane(file)
return luci.sys.process.info("uid")
- == luci.fs.stat(file or sessionpath, "uid")
- and luci.fs.stat(file or sessionpath, "modestr")
+ == fs.stat(file or sessionpath, "uid")
+ and fs.stat(file or sessionpath, "modestr")
== (file and "rw-------" or "rwx------")
end
@@ -106,5 +105,5 @@ function kill(id)
if not id:match("^%w+$") then
error("Session ID is not sane!")
end
- luci.fs.unlink(sessionpath .. "/" .. id)
-end \ No newline at end of file
+ fs.unlink(sessionpath .. "/" .. id)
+end
diff --git a/libs/web/luasrc/template.lua b/libs/web/luasrc/template.lua
index c8f4daa2dd..e8f65e3bec 100644
--- a/libs/web/luasrc/template.lua
+++ b/libs/web/luasrc/template.lua
@@ -24,7 +24,7 @@ limitations under the License.
]]--
-local fs = require "luci.fs"
+local fs = require "nixio.fs"
local sys = require "luci.sys"
local util = require "luci.util"
local table = require "table"
@@ -173,18 +173,18 @@ function Template.__init__(self, name)
local err
if compiler_mode == "file" then
- local tplmt = fs.mtime(sourcefile) or fs.mtime(sourcefile .. ".htm")
- local commt = fs.mtime(compiledfile)
+ local tplmt = fs.stat(sourcefile, "mtime") or fs.stat(sourcefile .. ".htm", "mtime")
+ local commt = fs.stat(compiledfile, "mtime")
if not fs.mtime(cdir) then
- fs.mkdir(cdir, true)
+ fs.mkdirr(cdir)
fs.chmod(fs.dirname(cdir), 777)
end
assert(tplmt or commt, "No such template: " .. name)
-- Build if there is no compiled file or if compiled file is outdated
- if not commt or (commt and tplmt and commt < tplmt) then
+ if not commt or (commt and tplmt and commt < tplmt) then
local source
source, err = fs.readfile(sourcefile) or fs.readfile(sourcefile .. ".htm")