Beide Module wurden aus einem anderen Kundenprojekt kopiert und bereinigt: Knowledgecenter: - Bild-Cache (1.985 Dateien) geleert, Ordnerstruktur mit .gitkeep behalten - Files-Gallery-Lizenzschlüssel entfernt (config.php) - Kundenspezifische Kategorien gelöscht: Teil I/II/III QM-Struktur, nummerierte QM-Kapitel, Gremien (Präsidium/Finanzausschuss/Landesausschuss), Sitzungsservice-Serie, Protokoll-Abteilungen, Testeinträge - 56 generische Kategorien bleiben (Downloads, Onboarding, Personalthemen …) Tasks: - Alle Betriebsdaten gelöscht (114 Tasks, 914 Submissions, 579 Assignments) - Task-Definitionen und Verlinkungen geleert - Kategoriestruktur bleibt (Allgemein, IT, Personal, Buchhaltung …) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
61 lines
1.8 KiB
PHP
61 lines
1.8 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/CronRuntime.php';
|
|
|
|
$usage = <<<TXT
|
|
Usage:
|
|
php cli/task_cert_recalculate_escalations.php [--apply|--dry-run] [--task_id=<id>] [--no-lock] [--json]
|
|
|
|
Options:
|
|
--apply Mutierender Lauf (Status/Eskalationslevel schreiben)
|
|
--dry-run Nur Vorschau, keine DB-Änderungen
|
|
--task_id Optional: nur eine Aufgabe verarbeiten
|
|
--no-lock Locking deaktivieren (nur Debug)
|
|
--json JSON-Ausgabe zusätzlich auf stdout
|
|
--help Diese Hilfe anzeigen
|
|
TXT;
|
|
|
|
try {
|
|
$options = TaskCertCronRuntime::parseOptions($argv, true);
|
|
} catch (InvalidArgumentException $exception) {
|
|
TaskCertCronRuntime::printOptionError($exception->getMessage(), $usage);
|
|
exit(2);
|
|
}
|
|
|
|
if ((bool) ($options['help'] ?? false)) {
|
|
TaskCertCronRuntime::printUsage($usage);
|
|
exit(0);
|
|
}
|
|
|
|
$exitCode = TaskCertCronRuntime::runWithHandling(
|
|
'recalculate_escalations',
|
|
$options,
|
|
static function () use ($options): array {
|
|
require_once dirname(__DIR__) . '/bootstrap.php';
|
|
$services = task_cert_services();
|
|
$escalationService = $services['escalationService'] ?? null;
|
|
if (!$escalationService instanceof EscalationService) {
|
|
throw new RuntimeException('EscalationService nicht verfügbar.');
|
|
}
|
|
|
|
$apply = (bool) ($options['apply'] ?? false);
|
|
$taskId = (int) ($options['task_id'] ?? 0);
|
|
|
|
$summary = $escalationService->recalculateEscalationsDetailed(
|
|
$apply,
|
|
$taskId > 0 ? $taskId : null
|
|
);
|
|
|
|
if ($apply) {
|
|
CronHeartbeat::record('recalculate_escalations', [
|
|
'changed' => (int) ($summary['changed_assignments'] ?? 0),
|
|
]);
|
|
}
|
|
|
|
return $summary;
|
|
}
|
|
);
|
|
|
|
exit($exitCode);
|