fix fgetcsv deprecation and apply pending DB migrations

This commit is contained in:
Pontoporeia
2026-03-28 19:13:52 +01:00
parent 126703f340
commit 5c00886db6
3 changed files with 7 additions and 5 deletions

View File

@@ -437,6 +437,8 @@ Goal: rename the tables and column to the canonical M2M pattern (`tags`, `thesis
`Database::setThesisLanguages()`, `setThesisFormats()`, `setThesisTags()` following the
delete-then-reinsert pattern of `setThesisJury()`; `formulaire.php` and `edit.php` updated.
- [x] Fix `fgetcsv()` deprecation warnings in `import.php` - added explicit `$escape = ''` parameter to all 5 calls
- [x] Run all pending DB migrations (001006) on `storage/posterg.db` - `tags`/`thesis_tags` tables now exist
- [ ] **`RateLimit` uses per-file JSON on disk** - reads, writes, and `glob()`s the filesystem on
every public request. For a low-traffic art-school site this is fine, but it creates a
write-on-every-hit pattern. Consider switching to APCu (if available) or SQLite (single INSERT)

View File

@@ -48,10 +48,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
}
// Skip first two rows (empty and headers)
fgetcsv($handle); // Empty row
$headers = fgetcsv($handle); // Header row
fgetcsv($handle); // Description row
$headers = fgetcsv($handle); // Actual column names
fgetcsv($handle, 0, ',', '"', ''); // Empty row
$headers = fgetcsv($handle, 0, ',', '"', ''); // Header row
fgetcsv($handle, 0, ',', '"', ''); // Description row
$headers = fgetcsv($handle, 0, ',', '"', ''); // Actual column names
// Map CSV columns
$columnMap = [
@@ -99,7 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
// Process each row
$lineNumber = 5; // Start after headers
while (($row = fgetcsv($handle)) !== false) {
while (($row = fgetcsv($handle, 0, ',', '"', '')) !== false) {
$lineNumber++;
// Skip empty rows

Binary file not shown.