Some rapid fix for v11

Some rapid fix for v11
This commit is contained in:
novgorodschi catalin
2026-07-23 12:18:46 +03:00
parent 8a2d727659
commit acc681f737
3 changed files with 59 additions and 9 deletions
+2 -2
View File
@@ -182,7 +182,7 @@ $cronKeyMasked = ($cronKey === '')
<?php } ?>
<tr>
<td>Database cleanup <em class="tooltip">?<span>Automation trims tables that would otherwise grow forever. Archived reports are never deleted. 0 disables a rule.</span></em></td>
<td>Database cleanup <em class="tooltip">?<span class="classic">Automation trims tables that would otherwise grow forever. Archived reports are never deleted. 0 disables a rule.</span></em></td>
<td><?php
$parts = array();
$parts[] = 'reports: ' . ($cleanReports > 0 ? $cleanReports . 'd' : 'off');
@@ -193,7 +193,7 @@ $cronKeyMasked = ($cronKey === '')
</tr>
<tr>
<td>Last cleanup run <em class="tooltip">?<span>Cleanup runs once per hour from Automation and deletes in batches, so a first run on an old server catches up over several passes.</span></em></td>
<td>Last cleanup run <em class="tooltip">?<span class="classic">Cleanup runs once per hour from Automation and deletes in batches, so a first run on an old server catches up over several passes.</span></em></td>
<td><?php
if (is_array($cleanupInfo) && !empty($cleanupInfo['time'])) {
$r = isset($cleanupInfo['removed']) ? $cleanupInfo['removed'] : array();
+35 -7
View File
@@ -112,13 +112,41 @@ class Process {
$findReplace["%CRONKEY%"] = bin2hex(random_bytes(24));
// Valori implicite pentru ciclul intern al cron.php; editabile ulterior
// din ACP (Config -> 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'];
+22
View File
@@ -296,6 +296,28 @@ foreach($mechs as $k => $l){
</div>
</div>
<div class="card">
<span class="f10 c">CRON &amp; AUTOMATION</span>
<div class="grid-2" style="margin-top:12px;">
<div><label>Cron invocation length (sec)</label><select class="input" name="cron_loop">
<option value="300" selected>300 - cron every 5 min (default)</option>
<option value="600">600 - cron every 10 min</option>
<option value="900">900 - cron every 15 min</option>
<option value="0">0 - cron every minute</option>
</select></div>
<div><label>Cron tick interval (sec)</label><input class="input" name="cron_tick" id="cron_tick" value="60"></div>
<div><label>Delete unarchived reports after (days)</label><input class="input" name="cleanup_reports" id="cleanup_reports" value="14"></div>
<div><label>Delete chat messages after (days)</label><input class="input" name="cleanup_chat" id="cleanup_chat" value="7"></div>
<div><label>Delete messages erased by both sides (days)</label><input class="input" name="cleanup_messages" id="cleanup_messages" value="0"></div>
</div>
<div class="f10" style="margin-top:8px;opacity:.75;">
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 &mdash; 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.
</div>
</div>
<div style="text-align:center;margin:18px 0;">
<button class="btn" type="submit" name="Submit" id="Submit">Save Configuration →</button>
</div>