mod_cron: Add a 'weekly' job frequency

This commit is contained in:
Kim Alvefur 2021-12-03 09:05:41 +01:00
parent d6070eea1f
commit 8aa16eaec0
4 changed files with 9 additions and 2 deletions

View file

@ -521,6 +521,11 @@ function api:daily(name, fun)
self:cron({ name = name; when = "daily"; run = fun });
end
function api:weekly(name, fun)
if type(name) == "function" then fun, name = name, nil; end
self:cron({ name = name; when = "weekly"; run = fun });
end
local path_sep = package.config:sub(1,1);
function api:get_directory()
return self.resource_path or self.path and (self.path:gsub("%"..path_sep.."[^"..path_sep.."]*$", "")) or nil;