From: Guenter Knauf Date: Sun, 30 Jun 2013 21:07:28 +0000 (+0000) Subject: Simplify example (backport r1498176 from trunk). X-Git-Tag: 2.4.5~58 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e3a51a99e64d610267ca793ea51829d83bdc70c7;p=apache Simplify example (backport r1498176 from trunk). Fix r.mpm_query() (backport r1498179 from trunk). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1498182 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index 90580f8aa4..1726401faa 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -726,7 +726,7 @@ local url = r:construct_url(r.uri) -r:mpm_query(number) -- Queries the server for MPM information using ap_mpm_query: +r.mpm_query(number) -- Queries the server for MPM information using ap_mpm_query: local mpm = r.mpm_query(14) if mpm == 1 then @@ -949,19 +949,14 @@ r:touch([mtime]) -- Sets the file modification time to current time or to option r:get_direntries(dir) -- Returns a table with all directory entries. --- Return path splitted into components dir, file, ext -function split_path(path) - return path:match("(.-)([^\\/]-%.?([^%.\\/]*))$") -end - function handle(r) - local cwd, _, _ = split_path(r.filename) - for _, f in ipairs(r:get_direntries(cwd)) do - local info = r:stat(cwd .. f) + local dir = r.context_document_root + for _, f in ipairs(r:get_direntries(dir)) do + local info = r:stat(dir .. "/" .. f) if info then local mtime = os.date(fmt, info.mtime / 1000000) local ftype = (info.filetype == 2) and "[dir] " or "[file]" - r:puts( ("%s %s %10i %s\n"):format(ftype, mtime, info.size, f) ) + r:puts( ("%s %s %10i %s\n"):format(ftype, mtime, info.size, f) ) end end end