httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fua...@apache.org
Subject svn commit: r1496483 - in /httpd/httpd/branches/2.4.x: CHANGES docs/manual/mod/mod_lua.xml modules/lua/lua_request.c
Date Tue, 25 Jun 2013 14:19:51 GMT
Author: fuankg
Date: Tue Jun 25 14:19:51 2013
New Revision: 1496483

URL: http://svn.apache.org/r1496483
Log:
Added new r:touch() function; updated docs.
(Backport r1495270, r1495665, r1495666)

Modified:
    httpd/httpd/branches/2.4.x/CHANGES
    httpd/httpd/branches/2.4.x/docs/manual/mod/mod_lua.xml
    httpd/httpd/branches/2.4.x/modules/lua/lua_request.c

Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1496483&r1=1496482&r2=1496483&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue Jun 25 14:19:51 2013
@@ -25,8 +25,8 @@ Changes with Apache 2.4.5
 
   *) mod_remoteip: close file in error path. [Christophe Jaillet]
 
-  *) mod_lua: Add some new functions: r:htpassword(), r:mkdir(), r:rmdir(),
-     r:get_direntries(), r.date_parse_rfc().
+  *) mod_lua: Add some new functions: r:htpassword(), r:mkdir(), r:mkrdir(),
+     r:rmdir(), r:touch(), r:get_direntries(), r.date_parse_rfc().
      [Guenter Knauf]
 
   *) mod_lua: Sync 2.4 branch with trunk. This includes (but is not limited to)

Modified: httpd/httpd/branches/2.4.x/docs/manual/mod/mod_lua.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/docs/manual/mod/mod_lua.xml?rev=1496483&r1=1496482&r2=1496483&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/docs/manual/mod/mod_lua.xml (original)
+++ httpd/httpd/branches/2.4.x/docs/manual/mod/mod_lua.xml Tue Jun 25 14:19:51 2013
@@ -936,10 +936,18 @@ r:mkdir(dir [,mode]) -- Creates a direct
 </highlight>
 
 <highlight language="lua">
+r:mkrdir(dir [,mode]) -- Creates directories recursive and sets mode to optional mode paramter.
+</highlight>
+
+<highlight language="lua">
 r:rmdir(dir) -- Removes a directory.
 </highlight>
 
 <highlight language="lua">
+r:touch([mtime]) -- Sets the file modification time to current time or to optional mtime
msec value.
+</highlight>
+
+<highlight language="lua">
 r:get_direntries(dir) -- Returns a table with all directory entries.
 
 -- Return path splitted into components dir, file, ext

Modified: httpd/httpd/branches/2.4.x/modules/lua/lua_request.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/modules/lua/lua_request.c?rev=1496483&r1=1496482&r2=1496483&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/modules/lua/lua_request.c (original)
+++ httpd/httpd/branches/2.4.x/modules/lua/lua_request.c Tue Jun 25 14:19:51 2013
@@ -872,6 +872,25 @@ static int lua_apr_htpassword(lua_State 
 }
 
 /*
+ * lua_apr_touch; r:touch(string [, time]) - Sets mtime of a file
+ */
+static int lua_apr_touch(lua_State *L)
+{
+    request_rec     *r;
+    const char      *path;
+    apr_status_t    status;
+    apr_time_t      mtime;
+
+    r = ap_lua_check_request_rec(L, 1);
+    luaL_checktype(L, 2, LUA_TSTRING);
+    path = lua_tostring(L, 2);
+    mtime = luaL_optnumber(L, 3, apr_time_now());
+    status = apr_file_mtime_set(path, mtime, r->pool);
+    lua_pushboolean(L, (status == 0));
+    return 1;
+}
+
+/*
  * lua_apr_mkdir; r:mkdir(string [, permissions]) - Creates a directory
  */
 static int lua_apr_mkdir(lua_State *L)
@@ -2153,6 +2172,8 @@ void ap_lua_load_request_lmodule(lua_Sta
                  makefun(&lua_apr_sha1, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "htpassword", APR_HASH_KEY_STRING,
                  makefun(&lua_apr_htpassword, APL_REQ_FUNTYPE_LUACFUN, p));
+    apr_hash_set(dispatch, "touch", APR_HASH_KEY_STRING,
+                 makefun(&lua_apr_touch, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "mkdir", APR_HASH_KEY_STRING,
                  makefun(&lua_apr_mkdir, APL_REQ_FUNTYPE_LUACFUN, p));
     apr_hash_set(dispatch, "mkrdir", APR_HASH_KEY_STRING,



Mime
View raw message