{
"event": "PreToolUse",
"tool_name": "Write",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/bin\/cleanup-stale-protokoll.php",
"content": "#!\/usr\/bin\/env php\n<?php\n\ndeclare(strict_types=1);\n\n\/\/ @responsibility: Cron-Job zum Aufräumen verwaister pending-Protokoll-Einträge\n\n\/**\n * Cleanup stale pending protokoll entries.\n *\n * Run via cron every 5 minutes:\n * *\/5 * * * * \/usr\/bin\/php \/var\/www\/dev.campus.systemische-tools.de\/bin\/cleanup-stale-protokoll.php\n *\/\n\nrequire __DIR__ . '\/..\/vendor\/autoload.php';\n\nuse Infrastructure\\Logging\\KiProtokollService;\nuse Infrastructure\\Persistence\\KiProtokollRepository;\n\n\/\/ Get PDO connection (ki_dev)\n$credentials = json_decode(file_get_contents('\/etc\/mcp-db\/credentials.json'), true);\n$dsn = sprintf(\n 'mysql:host=%s;port=%d;dbname=ki_dev;charset=utf8mb4',\n $credentials['host'],\n $credentials['port'] ?? 3306\n);\n$pdo = new PDO($dsn, $credentials['user'], $credentials['password'], [\n PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,\n PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,\n]);\n\n$repository = new KiProtokollRepository($pdo);\n$service = new KiProtokollService($repository);\n\n$minutesOld = (int) ($argv[1] ?? 10);\n$affected = $service->cleanupStale($minutesOld);\n\nif ($affected > 0) {\n fwrite(STDOUT, \"Cleaned up {$affected} stale protokoll entries (older than {$minutesOld} min)\\n\");\n}\n"
}
}
{
"tool_response": {
"type": "create",
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/bin\/cleanup-stale-protokoll.php",
"content": "#!\/usr\/bin\/env php\n<?php\n\ndeclare(strict_types=1);\n\n\/\/ @responsibility: Cron-Job zum Aufräumen verwaister pending-Protokoll-Einträge\n\n\/**\n * Cleanup stale pending protokoll entries.\n *\n * Run via cron every 5 minutes:\n * *\/5 * * * * \/usr\/bin\/php \/var\/www\/dev.campus.systemische-tools.de\/bin\/cleanup-stale-protokoll.php\n *\/\n\nrequire __DIR__ . '\/..\/vendor\/autoload.php';\n\nuse Infrastructure\\Logging\\KiProtokollService;\nuse Infrastructure\\Persistence\\KiProtokollRepository;\n\n\/\/ Get PDO connection (ki_dev)\n$credentials = json_decode(file_get_contents('\/etc\/mcp-db\/credentials.json'), true);\n$dsn = sprintf(\n 'mysql:host=%s;port=%d;dbname=ki_dev;charset=utf8mb4',\n $credentials['host'],\n $credentials['port'] ?? 3306\n);\n$pdo = new PDO($dsn, $credentials['user'], $credentials['password'], [\n PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,\n PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,\n]);\n\n$repository = new KiProtokollRepository($pdo);\n$service = new KiProtokollService($repository);\n\n$minutesOld = (int) ($argv[1] ?? 10);\n$affected = $service->cleanupStale($minutesOld);\n\nif ($affected > 0) {\n fwrite(STDOUT, \"Cleaned up {$affected} stale protokoll entries (older than {$minutesOld} min)\\n\");\n}\n",
"structuredPatch": [],
"originalFile": null
}
}