mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Combine phpstan, cs-check, cs-fix into lint-php recipe; fix lint issues + test failures + duplicate detection bug
This commit is contained in:
@@ -129,7 +129,8 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, 'cover',
|
||||
$thesisId,
|
||||
'cover',
|
||||
$relPath,
|
||||
basename($upload['name']),
|
||||
$upload['size'],
|
||||
@@ -184,7 +185,8 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, 'note_intention',
|
||||
$thesisId,
|
||||
'note_intention',
|
||||
$relPath,
|
||||
basename($upload['name']),
|
||||
$upload['size'],
|
||||
@@ -278,7 +280,7 @@ trait ThesisFileHandler
|
||||
}
|
||||
|
||||
// Sort by hierarchy rank
|
||||
usort($files, fn($a, $b) => $a['hierarchy'] - $b['hierarchy']);
|
||||
usort($files, fn ($a, $b) => $a['hierarchy'] - $b['hierarchy']);
|
||||
|
||||
// Assign contiguous TFE_XX numbers
|
||||
$videoCount = 0;
|
||||
@@ -527,7 +529,8 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, 'annex',
|
||||
$thesisId,
|
||||
'annex',
|
||||
$relPath,
|
||||
basename($uploads['name'][$i]),
|
||||
$uploads['size'][$i],
|
||||
@@ -600,7 +603,7 @@ trait ThesisFileHandler
|
||||
$limitMb = round($sizeLimit / 1024 / 1024);
|
||||
$sizeMb = round($uploads['size'][$i] / 1024 / 1024);
|
||||
$this->fileWarnings[] = "Annexe « {$uploads['name'][$i]} » ignorée : trop volumineuse ($sizeMb MB, max $limitMb MB).";
|
||||
error_log("ThesisFileHandler: annexe too large {$uploads['name'][$i]} (" . $sizeMb . " MB), skipping");
|
||||
error_log("ThesisFileHandler: annexe too large {$uploads['name'][$i]} (" . $sizeMb . ' MB), skipping');
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -620,7 +623,8 @@ trait ThesisFileHandler
|
||||
$fileType = ($ext === 'vtt' || $mimeType === 'text/vtt') ? 'caption' : 'annex';
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, $fileType,
|
||||
$thesisId,
|
||||
$fileType,
|
||||
$relPath,
|
||||
basename($uploads['name'][$i]),
|
||||
$uploads['size'][$i],
|
||||
@@ -653,7 +657,8 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, $f['fileType'],
|
||||
$thesisId,
|
||||
$f['fileType'],
|
||||
$relPath,
|
||||
basename($f['origName']),
|
||||
$f['size'],
|
||||
@@ -730,7 +735,7 @@ trait ThesisFileHandler
|
||||
*/
|
||||
protected function generateAuthorSlug(string $authorNames): string
|
||||
{
|
||||
$names = array_values(array_filter(array_map('trim', explode(',', $authorNames)), fn($n) => $n !== ''));
|
||||
$names = array_values(array_filter(array_map('trim', explode(',', $authorNames)), fn ($n) => $n !== ''));
|
||||
sort($names, SORT_NATURAL);
|
||||
$joined = implode('-', $names);
|
||||
|
||||
@@ -936,7 +941,8 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, $fileType,
|
||||
$thesisId,
|
||||
$fileType,
|
||||
$relPath,
|
||||
$originalName,
|
||||
$size,
|
||||
@@ -1008,12 +1014,14 @@ trait ThesisFileHandler
|
||||
$uuid = $parts[2] ?? '';
|
||||
$storedPath = 'peertube_ids:' . $uuid;
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, $fileType,
|
||||
$thesisId,
|
||||
$fileType,
|
||||
$storedPath,
|
||||
$uuid . ' (PeerTube)',
|
||||
0,
|
||||
$fileType === 'video' ? 'video/mp4' : 'audio/mpeg',
|
||||
null, null
|
||||
null,
|
||||
null
|
||||
);
|
||||
error_log("ThesisFileHandler: PeerTube file associated → $uuid");
|
||||
continue;
|
||||
@@ -1091,12 +1099,14 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, 'annex',
|
||||
$thesisId,
|
||||
'annex',
|
||||
$relPath,
|
||||
basename($f['origName']),
|
||||
$f['size'],
|
||||
$f['mimeType'],
|
||||
null, null
|
||||
null,
|
||||
null
|
||||
);
|
||||
error_log("ThesisFileHandler: annexe (filepond) → $targetName");
|
||||
$num++;
|
||||
@@ -1112,7 +1122,7 @@ trait ThesisFileHandler
|
||||
$f['hierarchy'] = $this->tfeHierarchyRank($f['mimeType'], $f['ext']);
|
||||
$filesWithRank[] = $f;
|
||||
}
|
||||
usort($filesWithRank, fn($a, $b) => $a['hierarchy'] - $b['hierarchy']);
|
||||
usort($filesWithRank, fn ($a, $b) => $a['hierarchy'] - $b['hierarchy']);
|
||||
|
||||
$num = $startNum;
|
||||
$vttIdx = 0;
|
||||
@@ -1170,7 +1180,8 @@ trait ThesisFileHandler
|
||||
$relPath = $folderPath . $targetName;
|
||||
|
||||
$this->db->insertThesisFile(
|
||||
$thesisId, $f['fileType'],
|
||||
$thesisId,
|
||||
$f['fileType'],
|
||||
$relPath,
|
||||
basename($f['origName']),
|
||||
$f['size'],
|
||||
@@ -1250,7 +1261,7 @@ trait ThesisFileHandler
|
||||
@copy($abs, $trashPath);
|
||||
@unlink($abs);
|
||||
}
|
||||
error_log("ThesisFileHandler: file \$fileId moved to trash → \$trashName");
|
||||
error_log("ThesisFileHandler: file {$fileId} moved to trash → {$trashName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user