From acc681f73780d3b96db4bb3a60419c8fa3b09707 Mon Sep 17 00:00:00 2001 From: novgorodschi catalin Date: Thu, 23 Jul 2026 12:18:46 +0300 Subject: [PATCH] Some rapid fix for v11 Some rapid fix for v11 --- Admin/Templates/config.tpl | 4 ++-- install/process.php | 42 ++++++++++++++++++++++++++++++------ install/templates/config.tpl | 22 +++++++++++++++++++ 3 files changed, 59 insertions(+), 9 deletions(-) diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index 8526f49b..d04b4293 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -182,7 +182,7 @@ $cronKeyMasked = ($cronKey === '') - Database cleanup ?Automation trims tables that would otherwise grow forever. Archived reports are never deleted. 0 disables a rule. + Database cleanup ?Automation trims tables that would otherwise grow forever. Archived reports are never deleted. 0 disables a rule. 0 ? $cleanReports . 'd' : 'off'); @@ -193,7 +193,7 @@ $cronKeyMasked = ($cronKey === '') - Last cleanup run ?Cleanup runs once per hour from Automation and deletes in batches, so a first run on an old server catches up over several passes. + Last cleanup run ?Cleanup runs once per hour from Automation and deletes in batches, so a first run on an old server catches up over several passes. Cron & Automation -> edit). - $findReplace["%CRONLOOP%"] = 300; - $findReplace["%CRONTICK%"] = 60; - // Retentii implicite pentru curatenia periodica din Automation - // (0 = regula dezactivata). - $findReplace["%CLEANUPREPORTS%"] = 14; - $findReplace["%CLEANUPCHAT%"] = 7; - $findReplace["%CLEANUPMESSAGES%"] = 0; + // Setarile de cron si de curatenie vin acum din formularul de instalare + // (sectiunea CRON & AUTOMATION). Valorile sunt limitate aici, ca un + // formular trimis modificat sa nu scrie ceva absurd in config.php. + $cronLoop = isset($_POST['cron_loop']) ? (int) $_POST['cron_loop'] : 300; + $cronTick = isset($_POST['cron_tick']) ? (int) $_POST['cron_tick'] : 60; + + if ($cronLoop < 0) { $cronLoop = 0; } + if ($cronLoop > 3300) { $cronLoop = 3300; } + if ($cronTick < 15) { $cronTick = 15; } + if ($cronTick > 900) { $cronTick = 900; } + + // Un ciclu mai scurt decat un tick nu are sens: il tratam ca "o singura + // rulare per invocare". + if ($cronLoop > 0 && $cronLoop < $cronTick) { $cronLoop = 0; } + + $findReplace["%CRONLOOP%"] = $cronLoop; + $findReplace["%CRONTICK%"] = $cronTick; + + // Retentiile curateniei periodice (0 = regula dezactivata). + $cleanupFields = array( + "%CLEANUPREPORTS%" => array('cleanup_reports', 14), + "%CLEANUPCHAT%" => array('cleanup_chat', 7), + "%CLEANUPMESSAGES%" => array('cleanup_messages', 0), + ); + + foreach ($cleanupFields as $placeholder => $field) { + list($postName, $default) = $field; + + $value = isset($_POST[$postName]) ? (int) $_POST[$postName] : $default; + + if ($value < 0) { $value = 0; } + if ($value > 3650) { $value = 3650; } + + $findReplace[$placeholder] = $value; + } $findReplace["%DOMAIN%"] = $_POST['domain']; $findReplace["%HOMEPAGE%"] = $_POST['homepage']; $findReplace["%SERVER%"] = $_POST['server']; diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 8e994457..b1f20bf0 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -296,6 +296,28 @@ foreach($mechs as $k => $l){ +
+ CRON & AUTOMATION +
+
+
+
+
+
+
+
+ Automation runs from cron.php instead of players' page loads. One cron invocation keeps working for + "invocation length" seconds and processes a tick every "tick interval" seconds — so a host that only + allows a cron every 5 minutes still gets processing every minute. 0 days disables a cleanup rule; + reports archived by players are never deleted. All of these can be changed later from the admin panel. +
+
+