projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e933d1a
)
Ensure hotdeploying
author
Steven Barth
<steven@midlink.org>
Wed, 5 Nov 2008 14:10:02 +0000
(14:10 +0000)
committer
Steven Barth
<steven@midlink.org>
Wed, 5 Nov 2008 14:10:02 +0000
(14:10 +0000)
libs/web/luasrc/dispatcher.lua
patch
|
blob
|
history
diff --git
a/libs/web/luasrc/dispatcher.lua
b/libs/web/luasrc/dispatcher.lua
index
8d79d7e
..
79532dd
100644
(file)
--- a/
libs/web/luasrc/dispatcher.lua
+++ b/
libs/web/luasrc/dispatcher.lua
@@
-300,28
+300,35
@@
end
-- @param path Controller base directory
-- @param suffix Controller file suffix
function createindex_plain(path, suffix)
-- @param path Controller base directory
-- @param suffix Controller file suffix
function createindex_plain(path, suffix)
+ local controllers = util.combine(
+ luci.fs.glob(path .. "*" .. suffix) or {},
+ luci.fs.glob(path .. "*/*" .. suffix) or {}
+ )
+
if indexcache then
local cachedate = fs.mtime(indexcache)
if indexcache then
local cachedate = fs.mtime(indexcache)
- if cachedate and cachedate > fs.mtime(path) then
+ if cachedate then
+ local realdate = 0
+ for _, obj in ipairs(controllers) do
+ local omtime = fs.mtime(path .. "/" .. obj)
+ realdate = (omtime and omtime > realdate) and omtime or realdate
+ end
- assert(
- sys.process.info("uid") == fs.stat(indexcache, "uid")
- and fs.stat(indexcache, "mode") == "rw-------",
- "Fatal: Indexcache is not sane!"
- )
+ if cachedate > realdate then
+ assert(
+ sys.process.info("uid") == fs.stat(indexcache, "uid")
+ and fs.stat(indexcache, "mode") == "rw-------",
+ "Fatal: Indexcache is not sane!"
+ )
- index = loadfile(indexcache)()
- return index
+ index = loadfile(indexcache)()
+ return index
+ end
end
end
index = {}
end
end
index = {}
- local controllers = util.combine(
- luci.fs.glob(path .. "*" .. suffix) or {},
- luci.fs.glob(path .. "*/*" .. suffix) or {}
- )
-
for i,c in ipairs(controllers) do
local module = "luci.controller." .. c:sub(#path+1, #c-#suffix):gsub("/", ".")
local mod = require(module)
for i,c in ipairs(controllers) do
local module = "luci.controller." .. c:sub(#path+1, #c-#suffix):gsub("/", ".")
local mod = require(module)