X-Git-Url: https://git.archive.openwrt.org/?a=blobdiff_plain;f=libs%2Fweb%2Fluasrc%2Fdispatcher.lua;h=b0f6c1e4daad6760506a73709662bd386adb4431;hb=30b216f774c2404a965807ddb93a4a4b2aaeac04;hp=71d2a5c740e4b075aaf3784800e1db39304684ed;hpb=2baab00b19fc6eb4e0aca4da035292e37d94a640;p=project%2Fluci.git diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 71d2a5c74..b0f6c1e4d 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