*) 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)
r:mkdir(dir [,mode]) -- Creates a directory and sets mode to optional mode paramter.
</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 1;
}
+/*
+ * 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
*/
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,