From: Guenter Knauf Date: Sun, 30 Jun 2013 20:45:58 +0000 (+0000) Subject: Simplify example. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c29928623856bda9f7811a4d409d591b6849a0f;p=thirdparty%2Fapache%2Fhttpd.git Simplify example. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1498176 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_lua.xml b/docs/manual/mod/mod_lua.xml index ee617d99b23..3b71f49c69a 100644 --- a/docs/manual/mod/mod_lua.xml +++ b/docs/manual/mod/mod_lua.xml @@ -949,19 +949,14 @@ r:touch(file [,mtime]) -- Sets the file modification time to current time or to 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