mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Add SQLite indexes for contenus page language/tag queries + WIP: Peertube orphans, dialogs, contact decoupling, context note, finality types
This commit is contained in:
@@ -43,6 +43,55 @@ $details = [];
|
||||
$db = new Database();
|
||||
$pdo = $db->getPDO();
|
||||
|
||||
// ── Individual deletion mode ────────────────────────────────────────────
|
||||
$individualFilepond = trim($_POST['filepond_dir'] ?? '');
|
||||
$individualTrash = trim($_POST['trash_file'] ?? '');
|
||||
|
||||
if ($individualFilepond !== '' || $individualTrash !== '') {
|
||||
if ($individualFilepond !== '') {
|
||||
$dirPath = $filepondDir . '/' . basename($individualFilepond);
|
||||
if (is_dir($dirPath) && str_starts_with(realpath($dirPath), realpath($filepondDir))) {
|
||||
rmdirRecursive($dirPath);
|
||||
$filepondRemoved = 1;
|
||||
$details[] = "filepond/$individualFilepond: suppression manuelle";
|
||||
} else {
|
||||
$errors[] = 'Dossier introuvable : ' . htmlspecialchars($individualFilepond);
|
||||
}
|
||||
}
|
||||
if ($individualTrash !== '') {
|
||||
$filePath = $trashDir . '/' . basename($individualTrash);
|
||||
if (is_file($filePath) && str_starts_with(realpath($filePath), realpath($trashDir))) {
|
||||
if (@unlink($filePath)) {
|
||||
$trashRemoved = 1;
|
||||
$details[] = "_trash/$individualTrash: suppression manuelle";
|
||||
} else {
|
||||
$errors[] = 'Impossible de supprimer : ' . htmlspecialchars($individualTrash);
|
||||
}
|
||||
} else {
|
||||
$errors[] = 'Fichier introuvable : ' . htmlspecialchars($individualTrash);
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
|
||||
// HTMX request: re-render the fragment
|
||||
if (isset($_SERVER['HTTP_HX_REQUEST'])) {
|
||||
header('HX-Trigger: refreshStats');
|
||||
require __DIR__ . '/cleanup-stats-fragment.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
echo json_encode([
|
||||
'success' => true,
|
||||
'filepond_removed' => $filepondRemoved,
|
||||
'trash_removed' => $trashRemoved,
|
||||
'errors' => $errors,
|
||||
'details' => $details,
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
// ── Determine PHP session save path ──────────────────────────────────────
|
||||
$sessionSavePath = session_save_path();
|
||||
if (!$sessionSavePath || $sessionSavePath === '') {
|
||||
|
||||
Reference in New Issue
Block a user