LuminaWebsite/raid_delete_action.php
Maaxxs 22a61d28be Allow permanently deleting archived raids
Wires up the bot API's existing DELETE /api/raids/{id}/permanent
endpoint: archived raids now get an "Endgültig löschen" button next
to "Wiederherstellen" (raids.manage only), gated by a confirmation
dialog since it's irreversible - unlike the existing archive action,
which only soft-deletes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 07:34:55 +02:00

29 lines
741 B
PHP

<?php
require_once __DIR__ . '/includes/bootstrap.php';
require_once __DIR__ . '/includes/raids_api.php';
require_permission('raids.manage');
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
redirect('/raids.php');
}
verify_csrf();
$status = (string) ($_POST['status'] ?? 'archived');
if (!in_array($status, RAID_STATUSES, true)) {
$status = 'archived';
}
$redirectTo = '/raids.php?status=' . urlencode($status);
$raidId = (int) ($_POST['raid_id'] ?? 0);
if ($raidId <= 0) {
redirect($redirectTo);
}
try {
delete_raid_permanently($raidId);
set_flash('success', 'Raid wurde endgültig gelöscht.');
} catch (Throwable $e) {
set_flash('error', 'Löschen fehlgeschlagen: ' . $e->getMessage());
}
redirect($redirectTo);