0 && $connection_id !== $connection_filter) continue; $matched++; $config = isset($connection['config']) && is_array($connection['config']) ? $connection['config'] : array(); $state_dir = rtrim((string)($config['state_dir'] ?? ''), '/'); if ($state_dir === '') { fwrite(STDERR, "Warmup für Verbindung #{$connection_id} übersprungen: Connector-State-Verzeichnis fehlt.\n"); $result = 1; continue; } // 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, // Piwigo-Aufruf und Restore nicht von einem Connector-Sync ersetzt werden. $base = escapeshellarg('/bin/bash').' '.escapeshellarg($guard).' '.escapeshellarg($state_dir) .' '.escapeshellarg(PHP_BINARY).' '.escapeshellarg($worker) .' --connection-id='.$connection_id .' --mode='.escapeshellarg($mode); if ($wait) { $output = array(); $exit = 1; @exec($base.' 2>&1', $output, $exit); foreach ($output as $line) fwrite(STDOUT, $line."\n"); if ($exit !== 0) $result = $exit; } else { $command = 'nohup '.$base.' >> '.escapeshellarg($log).' 2>&1 < /dev/null & echo $!'; $output = array(); $exit = 1; @exec($command, $output, $exit); $pid = isset($output[0]) ? (int)$output[0] : 0; if ($exit !== 0 || $pid <= 0) { fwrite(STDERR, "Warmup für Verbindung #{$connection_id} konnte nicht gestartet werden.\n"); $result = 1; continue; } $started++; fwrite(STDOUT, "Warmup {$mode} für Verbindung #{$connection_id} gestartet (PID {$pid}).\n"); } } if ($connection_filter > 0 && $matched === 0) { fwrite(STDERR, "WebDAV-Verbindung #{$connection_filter} wurde nicht als aktive Connector-Verbindung gefunden.\n"); exit(1); } if (!$wait) fwrite(STDOUT, "Gestartete Warmup-Prozesse: {$started}.\n"); exit($result);