]]--
local io = require "io"
+local fs = require "nixio.fs"
local util = require "luci.util"
-local posix = require "posix"
+local nixio = require "nixio"
local debug = require "debug"
local string = require "string"
local package = require "package"
end
function cache_enable(cachepath, mode)
- cachepath = cachepath or "/tmp/.luciccache"
+ cachepath = cachepath or "/tmp/luci-modulecache"
mode = mode or "r--r--r--"
local loader = package.loaders[2]
- local uid = posix.getpid("uid")
+ local uid = nixio.getpid("uid")
- if not posix.stat(cachepath) then
- posix.mkdir(cachepath)
+ if not fs.stat(cachepath) then
+ fs.mkdir(cachepath)
end
local function _encode_filename(name)
end
local function _load_sane(file)
- local stat = posix.stat(file)
+ local stat = fs.stat(file)
if stat and stat.uid == uid and stat.mode == mode then
return loadfile(file)
end
end
local function _write_sane(file, func)
- if posix.getpid("uid") == uid then
+ if nixio.getuid() == uid then
local fp = io.open(file, "w")
if fp then
fp:write(util.get_bytecode(func))
fp:close()
- posix.chmod(file, mode)
+ fs.chmod(file, mode)
end
end
end