Mercurial Hosting > luan
changeset 1200:1e351b0d385e
move remove_old_web_log_files to luanhost
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 01 Mar 2018 16:28:18 -0700 |
parents | 3995cbe5b00a |
children | 7f4a12fb7716 |
files | src/luan/host/run.luan |
diffstat | 1 files changed, 2 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/host/run.luan Wed Feb 28 23:21:03 2018 -0700 +++ b/src/luan/host/run.luan Thu Mar 01 16:28:18 2018 -0700 @@ -1,20 +1,15 @@ -require "luan:logging/init.luan" -- initialize logging +java() local Luan = require "luan:Luan.luan" local error = Luan.error local do_file = Luan.do_file or error() -local ipairs = Luan.ipairs or error() local Io = require "luan:Io.luan" -local print = Io.print or error() -local String = require "luan:String.luan" -local Time = require "luan:Time.luan" -local Thread = require "luan:Thread.luan" local Hosting = require "luan:host/Hosting.luan" local Logging = require "luan:logging/Logging.luan" local logger = Logging.logger "run" -java() local WebHandler = require "java:luan.host.WebHandler" Hosting.WebHandler = WebHandler + local here = Io.schemes.file(".").canonical().to_string() Hosting.sites_dir = here.."/sites/" @@ -33,20 +28,3 @@ handler = SafeHandler.new(handler) local server = Server.ForAddress.new("127.0.0.1",8080,handler) server.start() - - - -local function remove_old_web_log_files() - local expired = Time.now() - Time.period{days=30} - local sites_dir = Io.schemes.file(Hosting.sites_dir) - for _, site in ipairs(sites_dir.children()) do - local web = site.child("site/private/local/logs/web") - for _, file in ipairs(web.children() or {}) do - if file.last_modified() < expired then - file.delete() - end - end - end -end - -Thread.schedule( Time.period{days=1}, true, Thread.safe(remove_old_web_log_files,logger) )