summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/dispatcher.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-06-21 13:42:26 +0000
committerSteven Barth <steven@midlink.org>2009-06-21 13:42:26 +0000
commit30b216f774c2404a965807ddb93a4a4b2aaeac04 (patch)
tree2d4bbdadc263f495e358af0fda9baf5b02274c3b /libs/web/luasrc/dispatcher.lua
parent2baab00b19fc6eb4e0aca4da035292e37d94a640 (diff)
Drop support for luaposix and bitlib (obsoleted by nixio)
Mark luci.fs as deprecated
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r--libs/web/luasrc/dispatcher.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 71d2a5c740..b0f6c1e4da 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -30,6 +30,7 @@ local sys = require "luci.sys"
local init = require "luci.init"
local util = require "luci.util"
local http = require "luci.http"
+local nixio = require "nixio", require "nixio.util"
module("luci.dispatcher", package.seeall)
context = util.threadlocal()
@@ -210,7 +211,8 @@ function dispatch(request)
if (c and c.index) or not track.notemplate then
local tpl = require("luci.template")
local media = track.mediaurlbase or luci.config.main.mediaurlbase
- if not pcall(tpl.Template, "themes/%s/header" % fs.basename(media)) then
+ if not tpl.Template("themes/%s/header" % fs.basename(media)) then
+ --if not pcall(tpl.Template, "themes/%s/header" % fs.basename(media)) then
media = nil
for name, theme in pairs(luci.config.themes) do
if name:sub(1,1) ~= "." and pcall(tpl.Template,
@@ -411,7 +413,7 @@ function createindex_plain(path, suffixes)
if cachedate > realdate then
assert(
sys.process.info("uid") == fs.stat(indexcache, "uid")
- and fs.stat(indexcache, "mode") == "rw-------",
+ and fs.stat(indexcache, "modestr") == "rw-------",
"Fatal: Indexcache is not sane!"
)
@@ -438,8 +440,9 @@ function createindex_plain(path, suffixes)
end
if indexcache then
- fs.writefile(indexcache, util.get_bytecode(index))
- fs.chmod(indexcache, "a-rwx,u+rw")
+ local f = nixio.open(indexcache, "w", 600)
+ f:writeall(util.get_bytecode(index))
+ f:close()
end
end