mirror of
https://github.com/apache/httpd.git
synced 2025-08-05 16:55:50 +03:00
Added new r:touch() function.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1495270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -871,6 +871,25 @@ static int lua_apr_htpassword(lua_State *L)
|
||||
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
|
||||
*/
|
||||
@@ -2153,6 +2172,8 @@ void ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
|
||||
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,
|
||||
|
Reference in New Issue
Block a user