mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-24 05:26:19 +00:00
Some rapid fix for v11
Some rapid fix for v11
This commit is contained in:
+35
-7
@@ -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'];
|
||||
|
||||
@@ -296,6 +296,28 @@ foreach($mechs as $k => $l){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<span class="f10 c">CRON & 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 — 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>
|
||||
|
||||
Reference in New Issue
Block a user