mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-08-10 23:31:21 +02:00
cleanup modal: list stale files to remove; storage restructure: documents/ → {objet}/
This commit is contained in:
@@ -313,8 +313,10 @@ class ThesisEditController
|
||||
$year = intval($post['année'] ?? date('Y'));
|
||||
$title = trim($post['titre'] ?? '');
|
||||
$authors = trim($post['auteurice'] ?? '');
|
||||
$thesis = $this->db->getThesis($thesisId);
|
||||
$objet = $thesis['objet'] ?? 'tfe';
|
||||
|
||||
$tf = $this->buildThesisFolder($year, $authors, $title);
|
||||
$tf = $this->buildThesisFolder($year, $authors, $title, $objet);
|
||||
$folderPath = $tf['folderPath'];
|
||||
$filePrefix = $tf['filePrefix'];
|
||||
|
||||
@@ -322,11 +324,12 @@ class ThesisEditController
|
||||
$existingFiles = $this->db->getThesisFiles($thesisId);
|
||||
foreach ($existingFiles as $f) {
|
||||
$fp = $f['file_path'] ?? '';
|
||||
if (str_starts_with($fp, 'documents/') || str_starts_with($fp, 'theses/')) {
|
||||
if (preg_match('#^(theses|documents|tfe|these|frart)/#', $fp)) {
|
||||
$parts = explode('/', $fp);
|
||||
if (count($parts) >= 3) {
|
||||
$parentDir = $parts[0];
|
||||
$folderName = $parts[2];
|
||||
$folderPath = 'documents/' . $year . '/' . $folderName . '/';
|
||||
$folderPath = $parentDir . '/' . $year . '/' . $folderName . '/';
|
||||
$filePrefix = $folderName;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user