mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
cleanup modal: list stale files to remove; storage restructure: documents/ → {objet}/
This commit is contained in:
@@ -34,6 +34,7 @@ $now = time();
|
||||
// ── FilePond stats ───────────────────────────────────────────────────────
|
||||
$fpStaleCount = 0;
|
||||
$fpStaleSize = 0;
|
||||
$fpStaleFiles = [];
|
||||
$fpActiveCount = 0;
|
||||
$fpActiveSize = 0;
|
||||
|
||||
@@ -75,6 +76,12 @@ if (is_dir($filepondDir)) {
|
||||
if ($stale) {
|
||||
$fpStaleCount++;
|
||||
$fpStaleSize += $size;
|
||||
$fpStaleFiles[] = [
|
||||
'name' => $item,
|
||||
'size' => $size,
|
||||
'human' => humanBytes($size),
|
||||
'age_minutes' => $ageMinutes,
|
||||
];
|
||||
} else {
|
||||
$fpActiveCount++;
|
||||
$fpActiveSize += $size;
|
||||
@@ -96,6 +103,7 @@ while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
|
||||
$trStaleCount = 0;
|
||||
$trStaleSize = 0;
|
||||
$trStaleFiles = [];
|
||||
$trActiveCount = 0;
|
||||
$trActiveSize = 0;
|
||||
|
||||
@@ -131,6 +139,12 @@ if (is_dir($trashDir)) {
|
||||
if ($stale) {
|
||||
$trStaleCount++;
|
||||
$trStaleSize += $size;
|
||||
$trStaleFiles[] = [
|
||||
'name' => $item,
|
||||
'size' => $size,
|
||||
'human' => humanBytes($size),
|
||||
'age_days' => $ageDays,
|
||||
];
|
||||
} else {
|
||||
$trActiveCount++;
|
||||
$trActiveSize += $size;
|
||||
@@ -144,12 +158,14 @@ echo json_encode([
|
||||
'filepond_stale_count' => $fpStaleCount,
|
||||
'filepond_stale_size' => $fpStaleSize,
|
||||
'filepond_stale_human' => humanBytes($fpStaleSize),
|
||||
'filepond_stale_files' => $fpStaleFiles,
|
||||
'filepond_active_count' => $fpActiveCount,
|
||||
'filepond_active_size' => $fpActiveSize,
|
||||
'filepond_active_human' => humanBytes($fpActiveSize),
|
||||
'trash_stale_count' => $trStaleCount,
|
||||
'trash_stale_size' => $trStaleSize,
|
||||
'trash_stale_human' => humanBytes($trStaleSize),
|
||||
'trash_stale_files' => $trStaleFiles,
|
||||
'trash_active_count' => $trActiveCount,
|
||||
'trash_active_size' => $trActiveSize,
|
||||
'trash_active_human' => humanBytes($trActiveSize),
|
||||
|
||||
@@ -51,8 +51,8 @@ if (!$thesisId || $filePath === '') {
|
||||
relinkError(400, 'Paramètres invalides (thesis_id + file_path requis).');
|
||||
}
|
||||
|
||||
// Security: only allow paths under documents/ or theses/
|
||||
if (!preg_match('#^(documents|theses)/#', $filePath)) {
|
||||
// Security: only allow paths under tfe/ these/ frart/ documents/ or theses/
|
||||
if (!preg_match('#^(tfe|these|frart|documents|theses)/#', $filePath)) {
|
||||
relinkError(403, 'Chemin de fichier non autorisé.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user