{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/backup-restore\/index.php",
"old_string": " <td title=\"<?= htmlspecialchars($backup['file_path']) ?>\">\n <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($this->shortenPath($backup['file_path'])) ?><\/a>\n <\/td>\n <td><?= $backup['version'] ?><\/td>\n <td><span class=\"badge badge--<?= $backup['change_type'] ?>\"><?= $backup['change_type'] ?><\/span><\/td>\n <td><?= $this->formatBytes($backup['file_size']) ?><\/td>",
"new_string": " <td title=\"<?= htmlspecialchars($backup['file_path']) ?>\">\n <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($shortenPath($backup['file_path'])) ?><\/a>\n <\/td>\n <td><?= $backup['version'] ?><\/td>\n <td><span class=\"badge badge--<?= $backup['change_type'] ?>\"><?= $backup['change_type'] ?><\/span><\/td>\n <td><?= $formatBytes($backup['file_size']) ?><\/td>"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/backup-restore\/index.php",
"oldString": " <td title=\"<?= htmlspecialchars($backup['file_path']) ?>\">\n <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($this->shortenPath($backup['file_path'])) ?><\/a>\n <\/td>\n <td><?= $backup['version'] ?><\/td>\n <td><span class=\"badge badge--<?= $backup['change_type'] ?>\"><?= $backup['change_type'] ?><\/span><\/td>\n <td><?= $this->formatBytes($backup['file_size']) ?><\/td>",
"newString": " <td title=\"<?= htmlspecialchars($backup['file_path']) ?>\">\n <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($shortenPath($backup['file_path'])) ?><\/a>\n <\/td>\n <td><?= $backup['version'] ?><\/td>\n <td><span class=\"badge badge--<?= $backup['change_type'] ?>\"><?= $backup['change_type'] ?><\/span><\/td>\n <td><?= $formatBytes($backup['file_size']) ?><\/td>",
"originalFile": "<?php\nob_start();\n\n\/\/ Helper functions\n$shortenPath = function (string $path): string {\n $maxLength = 50;\n if (strlen($path) <= $maxLength) {\n return $path;\n }\n $filename = basename($path);\n $dir = dirname($path);\n $available = $maxLength - strlen($filename) - 4;\n if ($available > 10) {\n return substr($dir, 0, $available) . '\/...\/' . $filename;\n }\n return '...' . substr($path, -($maxLength - 3));\n};\n\n$formatBytes = function (int $bytes): string {\n if ($bytes >= 1048576) {\n return number_format($bytes \/ 1048576, 1) . ' MB';\n }\n if ($bytes >= 1024) {\n return number_format($bytes \/ 1024, 1) . ' KB';\n }\n return $bytes . ' B';\n};\n?>\n\n<h1>File Backup<\/h1>\n\n<div class=\"stats-grid\">\n <div class=\"stat-card\">\n <span class=\"stat-card__value\"><?= $stats['total'] ?? 0 ?><\/span>\n <span class=\"stat-card__label\">Backups<\/span>\n <\/div>\n <div class=\"stat-card stat-card--info\">\n <span class=\"stat-card__value\"><?= $stats['files'] ?? 0 ?><\/span>\n <span class=\"stat-card__label\">Dateien<\/span>\n <\/div>\n <div class=\"stat-card stat-card--warning\">\n <span class=\"stat-card__value\"><?= $stats['modified'] ?? 0 ?><\/span>\n <span class=\"stat-card__label\">Geändert<\/span>\n <\/div>\n <div class=\"stat-card stat-card--success\">\n <span class=\"stat-card__value\"><?= $stats['recent'] ?? 0 ?><\/span>\n <span class=\"stat-card__label\">Letzte 24h<\/span>\n <\/div>\n<\/div>\n\n<h2>Backup-Historie<\/h2>\n<div class=\"filters\">\n <input type=\"search\" id=\"backup-search\" class=\"form-input\" placeholder=\"Dateipfad durchsuchen...\">\n <select id=\"filter-change-type\" class=\"form-select--inline\">\n <option value=\"\">Alle Typen<\/option>\n <option value=\"created\">Erstellt<\/option>\n <option value=\"modified\">Geändert<\/option>\n <\/select>\n<\/div>\n\n<table id=\"backup-table\" data-sortable>\n <thead>\n <tr>\n <th data-sort=\"id\">ID<\/th>\n <th data-sort=\"file_path\">Dateipfad<\/th>\n <th data-sort=\"version\">Version<\/th>\n <th data-sort=\"change_type\">Typ<\/th>\n <th data-sort=\"file_size\">Größe<\/th>\n <th data-sort=\"changed_at\">Datum<\/th>\n <\/tr>\n <\/thead>\n <tbody>\n <?php if (!empty($backups)): ?>\n <?php foreach ($backups as $backup): ?>\n <tr>\n <td><a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= $backup['id'] ?><\/a><\/td>\n <td title=\"<?= htmlspecialchars($backup['file_path']) ?>\">\n <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($this->shortenPath($backup['file_path'])) ?><\/a>\n <\/td>\n <td><?= $backup['version'] ?><\/td>\n <td><span class=\"badge badge--<?= $backup['change_type'] ?>\"><?= $backup['change_type'] ?><\/span><\/td>\n <td><?= $this->formatBytes($backup['file_size']) ?><\/td>\n <td><?= substr($backup['changed_at'], 0, 16) ?><\/td>\n <\/tr>\n <?php endforeach; ?>\n <?php else: ?>\n <tr><td colspan=\"6\" class=\"empty-state empty-state--small\">Keine Backups vorhanden<\/td><\/tr>\n <?php endif; ?>\n <\/tbody>\n<\/table>\n\n<p class=\"links-bar\">\n <a href=\"\/docs\/modul\/file-backup-hook\">Dokumentation<\/a>\n<\/p>\n\n<script type=\"module\">\nimport { init } from '\/js\/components\/data-table.js';\n\nconst dataTable = init({\n clock: { now_epoch_ms_utc: () => Date.now() },\n logger: console,\n ui: {\n showMessage: (msg) => { console.log(msg.type + ': ' + msg.text); },\n disableFeature: (key) => { console.warn('Feature disabled: ' + key); },\n offerRetry: () => Promise.resolve(false)\n },\n runId: crypto.randomUUID()\n});\n\ndataTable.create('backup-table', {\n searchInput: 'backup-search',\n pageSize: 20,\n filters: {\n 'filter-change-type': 3\n }\n});\n<\/script>\n\n<?php $content = ob_get_clean(); ?>\n<?php require VIEW_PATH . '\/layout.php'; ?>\n",
"structuredPatch": [
{
"oldStart": 75,
"oldLines": 11,
"newStart": 75,
"newLines": 11,
"lines": [
" <tr>",
" <td><a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= $backup['id'] ?><\/a><\/td>",
" <td title=\"<?= htmlspecialchars($backup['file_path']) ?>\">",
"- <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($this->shortenPath($backup['file_path'])) ?><\/a>",
"+ <a href=\"\/backup-restore\/<?= $backup['id'] ?>\"><?= htmlspecialchars($shortenPath($backup['file_path'])) ?><\/a>",
" <\/td>",
" <td><?= $backup['version'] ?><\/td>",
" <td><span class=\"badge badge--<?= $backup['change_type'] ?>\"><?= $backup['change_type'] ?><\/span><\/td>",
"- <td><?= $this->formatBytes($backup['file_size']) ?><\/td>",
"+ <td><?= $formatBytes($backup['file_size']) ?><\/td>",
" <td><?= substr($backup['changed_at'], 0, 16) ?><\/td>",
" <\/tr>",
" <?php endforeach; ?>"
]
}
],
"userModified": false,
"replaceAll": false
}
}