mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
migrate apropos data from config/apropos.php to SQLite
- Create apropos_contents table via migration 010 - Add Database methods: getAproposContent(), saveAproposContent(), getAllAproposContents() - Replace admin/pages.php with admin/contenus.php (renamed header from 'Pages statiques' to 'Contenus') - Replace admin/pages-edit.php with admin/contenus-edit.php (support editing pages + apropos contents) - Create admin/actions/apropos.php for saving apropos data (contacts, credits, erg_url) - Update public/apropos.php to read contacts/credits/erg_url from DB - Delete config/apropos.php
This commit is contained in:
14
storage/migrations/010_apropos_contents.sql
Normal file
14
storage/migrations/010_apropos_contents.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
-- ── apropos_contents table (structured data for the "À propos" page) ───────
|
||||
-- Replaces config/apropos.php.
|
||||
CREATE TABLE IF NOT EXISTS apropos_contents (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
key TEXT NOT NULL UNIQUE, -- 'contacts', 'credits', 'erg_url'
|
||||
value TEXT, -- JSON array for contacts/credits, plain string for erg_url
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
-- Seed with the current defaults from config/apropos.php
|
||||
INSERT OR IGNORE INTO apropos_contents (key, value) VALUES
|
||||
('contacts', '[{"name":"Laurent Leprince","role":"Bibliothèque d''architecture, d''ingénierie architecturale, d''urbanisme (BAIU) :","email":"laurent.leprince@uclouvain.be"},{"name":"Xavier Gorgol","role":"Responsable des mémoires de l''ERG :","email":"xavier.gorgol@erg.be"},{"name":"Brigitte Ledune","role":"Cours de suivi de mémoire :","email":"brigitte.ledune@erg.be"}]'),
|
||||
('credits', '[{"label":"Design & développement","value":"Olivia Marly, Théophile Gerveau-Mercie & Théo Hennequin"},{"label":"Typographies","value":"Ductus (Amélie Dumont) & BBB DM Sans"}]'),
|
||||
('erg_url', 'https://erg.be');
|
||||
3
storage/migrations/011_apropos_urls.sql
Normal file
3
storage/migrations/011_apropos_urls.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
-- Optional URL fields for credits and contacts.
|
||||
-- No structural change; items already stored as JSON with optional url keys.
|
||||
-- Default data updated to include urls where applicable.
|
||||
Binary file not shown.
@@ -319,8 +319,23 @@ CREATE TABLE IF NOT EXISTS pages (
|
||||
INSERT OR IGNORE INTO pages (slug, title, content) VALUES
|
||||
('charte', 'Charte', 'Contenu à venir'),
|
||||
('about', 'À propos', 'Contenu à venir'),
|
||||
('licenses', 'Licences', 'Contenu à venir'),
|
||||
('contact', 'Contact', 'Contenu à venir');
|
||||
('licenses', 'Licences', 'Contenu à venir');
|
||||
|
||||
-- ============================================================================
|
||||
-- APROPOS CONTENTS (structured data for the "À propos" page)
|
||||
-- ============================================================================
|
||||
|
||||
CREATE TABLE IF NOT EXISTS apropos_contents (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
key TEXT NOT NULL UNIQUE, -- 'contacts', 'credits', 'erg_url'
|
||||
value TEXT, -- JSON array or plain string
|
||||
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
|
||||
INSERT OR IGNORE INTO apropos_contents (key, value) VALUES
|
||||
('contacts', '[{"name":"Laurent Leprince","role":"Bibliothèque d''architecture, d''ingénierie architecturale, d''urbanisme (BAIU) :","email":"laurent.leprince@uclouvain.be"},{"name":"Xavier Gorgol","role":"Responsable des mémoires de l''ERG :","email":"xavier.gorgol@erg.be"},{"name":"Brigitte Ledune","role":"Cours de suivi de mémoire :","email":"brigitte.ledune@erg.be"}]'),
|
||||
('credits', '[{"label":"Design & développement","value":"Olivia Marly, Théophile Gerveau-Mercie & Théo Hennequin"},{"label":"Typographies","value":"Ductus (Amélie Dumont) & BBB DM Sans"}]'),
|
||||
('erg_url', 'https://erg.be');
|
||||
|
||||
-- ============================================================================
|
||||
-- INDEXES for performance
|
||||
@@ -365,6 +380,12 @@ CREATE TRIGGER IF NOT EXISTS update_pages_timestamp
|
||||
AFTER UPDATE ON pages
|
||||
BEGIN
|
||||
UPDATE pages SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
|
||||
END
|
||||
|
||||
CREATE TRIGGER IF NOT EXISTS update_apropos_contents_timestamp
|
||||
AFTER UPDATE ON apropos_contents
|
||||
BEGIN
|
||||
UPDATE apropos_contents SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
|
||||
END;
|
||||
|
||||
-- ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user