mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 03:29:19 +02:00
fix fgetcsv deprecation and apply pending DB migrations
This commit is contained in:
2
TODO.md
2
TODO.md
@@ -437,6 +437,8 @@ Goal: rename the tables and column to the canonical M2M pattern (`tags`, `thesis
|
|||||||
`Database::setThesisLanguages()`, `setThesisFormats()`, `setThesisTags()` following the
|
`Database::setThesisLanguages()`, `setThesisFormats()`, `setThesisTags()` following the
|
||||||
delete-then-reinsert pattern of `setThesisJury()`; `formulaire.php` and `edit.php` updated.
|
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 (001–006) 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
|
- [ ] **`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
|
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)
|
write-on-every-hit pattern. Consider switching to APCu (if available) or SQLite (single INSERT)
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip first two rows (empty and headers)
|
// Skip first two rows (empty and headers)
|
||||||
fgetcsv($handle); // Empty row
|
fgetcsv($handle, 0, ',', '"', ''); // Empty row
|
||||||
$headers = fgetcsv($handle); // Header row
|
$headers = fgetcsv($handle, 0, ',', '"', ''); // Header row
|
||||||
fgetcsv($handle); // Description row
|
fgetcsv($handle, 0, ',', '"', ''); // Description row
|
||||||
$headers = fgetcsv($handle); // Actual column names
|
$headers = fgetcsv($handle, 0, ',', '"', ''); // Actual column names
|
||||||
|
|
||||||
// Map CSV columns
|
// Map CSV columns
|
||||||
$columnMap = [
|
$columnMap = [
|
||||||
@@ -99,7 +99,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
|
|||||||
|
|
||||||
// Process each row
|
// Process each row
|
||||||
$lineNumber = 5; // Start after headers
|
$lineNumber = 5; // Start after headers
|
||||||
while (($row = fgetcsv($handle)) !== false) {
|
while (($row = fgetcsv($handle, 0, ',', '"', '')) !== false) {
|
||||||
$lineNumber++;
|
$lineNumber++;
|
||||||
|
|
||||||
// Skip empty rows
|
// Skip empty rows
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user