Gate periodic warmup before scanning Piwigo

This commit is contained in:
Terranom674
2026-09-03 12:51:30 +02:00
parent 4beb8f8420
commit c2408819f0

View File

@@ -91,6 +91,27 @@ foreach (bratonien_tools_nc_connector_connections() as $connection)
continue; continue;
} }
if ($mode === 'periodic')
{
$state_file = PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'bratonien-webdav-warmup.connection-'.$connection_id.'.json';
if (is_file($state_file) && is_readable($state_file))
{
$raw = @file_get_contents($state_file);
$state = $raw !== false ? json_decode($raw, true) : null;
if (is_array($state))
{
$last = (int)($state['last_periodic_at'] ?? 0);
$interval = max(1, (int)$settings['periodic_hours']) * 3600;
if ($last > 0 && time() - $last < $interval)
{
$remaining = max(0, $interval - (time() - $last));
fwrite(STDOUT, "Periodische Warmup-Prüfung für Verbindung #{$connection_id} noch nicht fällig ({$remaining}s verbleibend).\n");
continue;
}
}
}
}
// Der Guard hält webdav-sync.lock für den gesamten Worker-Lauf geteilt. // Der Guard hält webdav-sync.lock für den gesamten Worker-Lauf geteilt.
// Dadurch kann der produktive Source-/Shadow-Tree während Download, Swap, // Dadurch kann der produktive Source-/Shadow-Tree während Download, Swap,
// Piwigo-Aufruf und Restore nicht von einem Connector-Sync ersetzt werden. // Piwigo-Aufruf und Restore nicht von einem Connector-Sync ersetzt werden.