Compare commits

10 Commits

Author SHA1 Message Date
cedricAbonnel 331e9c9ecd chore : version 1.6.0 — bouton Mettre à jour, branche dev, guard git pull
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 11:16:35 +02:00
cedricAbonnel 0280ef3ca1 docs : architecture articles git (varlog.git + abonnel-www.git), sync bidirectionnelle
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 11:16:35 +02:00
cedricAbonnel eddde2165a fix : run_engine_update vérifie origin == folio_repo_url avant git pull
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 11:16:35 +02:00
cedricAbonnel 07d004b3f0 feat : bouton unique Mettre à jour (git pull + SQL + contenu), branche dev
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 11:16:35 +02:00
cedricAbonnel 5cb0e854fd Merge pull request 'release 1.5.0 : config admin FOLIO_REPO_URL, APP_TIMEZONE, push.sh protégé' (#68) from dev into main
release 1.5.0 : config admin FOLIO_REPO_URL, APP_TIMEZONE, push.sh protégé
2026-05-15 08:07:04 +00:00
cedricAbonnel 5452fb4927 Merge pull request 'feat : FOLIO_REPO_URL et APP_TIMEZONE configurables depuis admin' (#67) from feat/folio-repo-url-admin-config into main
Reviewed-on: #67
2026-05-15 07:52:17 +00:00
cedricAbonnel de8785d088 fix : déplacer config mises à jour Folio dans l'onglet Site
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 09:48:40 +02:00
cedricAbonnel 4b5943c0a4 feat : FOLIO_REPO_URL et branche configurables depuis l'admin (dashboard)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 09:48:40 +02:00
cedricAbonnel a552f105cd fix : masquer bouton Vérifier si FOLIO_REPO_URL non configuré, message explicatif
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 09:48:40 +02:00
cedricAbonnel 16afec3039 fix : APP_TIMEZONE configurable (défaut Europe/Paris), FOLIO_REPO_URL dans .env.example
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 09:48:40 +02:00
10 changed files with 225 additions and 40 deletions
+7
View File
@@ -6,6 +6,7 @@
APP_URL=https://example.com APP_URL=https://example.com
APP_ENV=prod APP_ENV=prod
APP_DEBUG=0 APP_DEBUG=0
APP_TIMEZONE=Europe/Paris
# Authentification admin (email de l'administrateur principal) # Authentification admin (email de l'administrateur principal)
ADMIN_EMAIL= ADMIN_EMAIL=
@@ -40,6 +41,12 @@ SMTP_FROM_NAME=
CONTACT_EMAIL= CONTACT_EMAIL=
CONTACT_FROM_EMAIL= CONTACT_FROM_EMAIL=
# Dépôt Folio pour le vérificateur de mises à jour (UpdateChecker)
# URL de base du dépôt Gitea (sans slash final)
FOLIO_REPO_URL=https://git.abonnel.fr/cedricAbonnel/folio
# Branche suivie pour les mises à jour (défaut : main)
# FOLIO_UPDATE_BRANCH=main
# Chemin absolu vers le répertoire des articles (data/) # Chemin absolu vers le répertoire des articles (data/)
# Par défaut : BASE_PATH/data (dans le répertoire de l'application) # Par défaut : BASE_PATH/data (dans le répertoire de l'application)
# Recommandé en production : chemin hors du répertoire web, ex. /srv/data/folio # Recommandé en production : chemin hors du répertoire web, ex. /srv/data/folio
+11
View File
@@ -9,6 +9,17 @@ Format : [Keep a Changelog](https://keepachangelog.com/fr/1.0.0/) — versionnag
--- ---
## [1.6.0] - 2026-05-15
### Ajouté
- Admin → Dashboard : bouton unique **Mettre à jour** (git pull + migrations SQL + migrations contenu) remplace les boutons séparés
- Branche `dev` : branche d'intégration permanente pour le développement quotidien
### Corrigé
- `run_engine_update` : vérifie que le remote git `origin` correspond à `FOLIO_REPO_URL` avant tout `git pull` (évite le pull sur le mauvais dépôt)
---
## [1.5.0] - 2026-05-15 ## [1.5.0] - 2026-05-15
### Ajouté ### Ajouté
+34 -12
View File
@@ -22,29 +22,51 @@ Les articles ne sont pas versionnés dans ce dépôt. Ils ont leur propre git lo
## Modifier le moteur ## Modifier le moteur
Pour toute correction ou fonctionnalité : **créer un ticket et une PR**. ### Branches
1. Coder ici dans `~/Projects/folio/` (branche feature) | Branche | Rôle |
2. **Tester sur varlog.a5l.fr** : |---------|------|
| `dev` | Branche d'intégration permanente. **Tout le développement courant se fait ici.** |
| `main` | Branche de production. **Jamais de commit direct.** |
| `feat/*` | Branches feature optionnelles pour du travail isolé, mergées dans `dev`. |
### Workflow
1. Toujours travailler sur `dev` (ou une branche feature mergée dans `dev`) :
```bash
git checkout dev
```
2. **Tester sur varlog.a5l.fr** à chaque itération (rsync des fichiers locaux, DB persistante) :
```bash ```bash
~/Projects/varlog/scripts/sync.sh ~/Projects/varlog/scripts/sync.sh
# puis tester sur http://varlog.acegrp.lan # puis tester sur http://varlog.acegrp.lan
``` ```
3. Une fois validé, ouvrir une PR sur Gitea. Le commit doit inclure : 3. Quand `dev` est stable et prête pour la production :
- `public/version.txt` (bump semver) - Bumper `public/version.txt` (semver)
- `CHANGELOG.md` (entrée `### Ajouté / Corrigé / Modifié`) - Ajouter une entrée `CHANGELOG.md` (`### Ajouté / Corrigé / Modifié`)
- Ouvrir une **PR `dev` → `main`** sur Gitea
4. Merger la PR → abonnel.fr se met à jour automatiquement. 4. Merger la PR → abonnel.fr se met à jour automatiquement.
**Règle absolue : ne jamais commiter directement sur `main`.** Le script `scripts/push.sh` bloque cette action.
### Pourquoi `dev` et non des branches feature à la volée
- La DB de varlog (test) accumule les migrations au fil du temps — changer de branche ne fait pas reculer les migrations.
- Travailler toujours sur `dev` évite toute désynchronisation entre le code rsyncé et la DB.
## Données articles (`DATA_PATH`) ## Données articles (`DATA_PATH`)
Les articles sont stockés dans un répertoire **hors du dépôt Folio**, configurable via `DATA_PATH` dans `.env`. Les articles sont stockés dans un répertoire **hors du dépôt Folio**, configurable via `DATA_PATH` dans `.env` (défaut production : `/srv/data/folio`).
| Environnement | Chemin local | Chemin serveur | | Environnement | Dépôt local articles | Dépôt Gitea | Serveur |
|--------------|-------------|----------------| |--------------|---------------------|------------|---------|
| varlog | `~/Projects/varlog-data/` | `/srv/data/folio` | | varlog | `~/Projects/varlog-data/` | `cedricAbonnel/varlog` | `varlog:/srv/data/folio` |
| abonnel.fr | `~/Projects/fr.abonnel.www-data/` | `/srv/data/folio` | | abonnel.fr | `~/Projects/fr.abonnel.www-data/` | `cedricAbonnel/abonnel-www` | `abonnel-wiki:/srv/data/folio` |
Les scripts de sync (`pull-data.sh`, `push-data.sh`, `sync.sh`) utilisent `DATA_DIR` (overridable via env) pointant vers ces chemins locaux. Sync bidirectionnelle via **git** (pas rsync). Scripts dans `~/Projects/varlog/scripts/` et `~/Projects/fr.abonnel.www/scripts/` :
- `pull-data.sh` : commit auto serveur + git pull local
- `push-data.sh` : git commit local + git push + git pull serveur
- `sync.sh` : moteur (rsync) + articles (git bidirectionnel)
## Asymétrie de déploiement moteur ## Asymétrie de déploiement moteur
+4
View File
@@ -6,6 +6,10 @@ if (!defined('BASE_PATH')) {
define('BASE_PATH', __DIR__); define('BASE_PATH', __DIR__);
} }
$__tz = $_ENV['APP_TIMEZONE'] ?? getenv('APP_TIMEZONE') ?: 'Europe/Paris';
date_default_timezone_set($__tz);
unset($__tz);
if (!defined('DATA_PATH')) { if (!defined('DATA_PATH')) {
$__dataPath = $_ENV['DATA_PATH'] ?? getenv('DATA_PATH') ?: ''; $__dataPath = $_ENV['DATA_PATH'] ?? getenv('DATA_PATH') ?: '';
define('DATA_PATH', $__dataPath !== '' ? rtrim($__dataPath, '/') : BASE_PATH . '/data'); define('DATA_PATH', $__dataPath !== '' ? rtrim($__dataPath, '/') : BASE_PATH . '/data');
+92 -1
View File
@@ -45,7 +45,7 @@ $action = $_GET['action'] ?? 'list';
$uuid = $_GET['uuid'] ?? ''; $uuid = $_GET['uuid'] ?? '';
$slug = $_GET['slug'] ?? ''; $slug = $_GET['slug'] ?? '';
$_noindexActions = ['create', 'edit', 'admin', 'categories', 'diff', 'add_files', 'import_image', 'import_image_step2', 'sources', 'profile', 'delete_file', 'delete_external_link', 'rename_category', 'delete_category', 'toggle_private_category', 'admin_save_site', 'not_found', 'add_feed', 'delete_feed', 'add_link', 'delete_link', 'reorder_links', 'react', 'comment', 'verify_comment', 'comment_moderate', 'comment_delete', 'comment_resend', 'create_tag_type', 'delete_tag_type', 'edit_tags', 'book_save', 'book_delete', 'admin_save_as_groups']; $_noindexActions = ['create', 'edit', 'admin', 'categories', 'diff', 'add_files', 'import_image', 'import_image_step2', 'sources', 'profile', 'delete_file', 'delete_external_link', 'rename_category', 'delete_category', 'toggle_private_category', 'admin_save_site', 'not_found', 'add_feed', 'delete_feed', 'add_link', 'delete_link', 'reorder_links', 'react', 'comment', 'verify_comment', 'comment_moderate', 'comment_delete', 'comment_resend', 'create_tag_type', 'delete_tag_type', 'edit_tags', 'book_save', 'book_delete', 'admin_save_as_groups', 'admin_save_folio_config', 'run_engine_update'];
$metaRobots = in_array($action, $_noindexActions, true) ? 'noindex, nofollow' : null; $metaRobots = in_array($action, $_noindexActions, true) ? 'noindex, nofollow' : null;
unset($_noindexActions); unset($_noindexActions);
@@ -2816,6 +2816,83 @@ switch ($action) {
header('Location: /admin?tab=dashboard&notice=' . ($_cmErrors ? 'migration_error' : 'migrated')); header('Location: /admin?tab=dashboard&notice=' . ($_cmErrors ? 'migration_error' : 'migrated'));
exit; exit;
case 'run_engine_update':
requireAuth();
if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(403);
exit;
}
// 1. git pull — vérifier que origin pointe vers le dépôt folio configuré
$_folioRepo = rtrim(folioRepoUrl(), '/');
exec('git -C ' . escapeshellarg(BASE_PATH) . ' remote get-url origin 2>&1', $_originOut, $_originCode);
$_originUrl = rtrim(trim(implode('', $_originOut)), '/');
// Normaliser : supprimer les credentials éventuels de l'URL (token@host → host)
$_originNorm = preg_replace('#https?://[^@]+@#', 'https://', $_originUrl);
$_repoNorm = preg_replace('#https?://[^@]+@#', 'https://', $_folioRepo);
if ($_originCode !== 0 || $_originNorm !== $_repoNorm) {
$_SESSION['_update_log'] = "Le remote git 'origin' (" . $_originUrl . ") ne correspond pas à FOLIO_REPO_URL (" . $_folioRepo . "). git pull annulé.";
header('Location: /admin?tab=dashboard&notice=update_git_error');
exit;
}
exec('cd ' . escapeshellarg(BASE_PATH) . ' && git pull origin main 2>&1', $_gitOut, $_gitCode);
if ($_gitCode !== 0) {
$_SESSION['_update_log'] = implode("\n", $_gitOut);
header('Location: /admin?tab=dashboard&notice=update_git_error');
exit;
}
// 2. composer install (non-bloquant si absent)
exec('which composer 2>/dev/null', $_composerPath);
if (!empty($_composerPath)) {
exec('cd ' . escapeshellarg(BASE_PATH) . ' && composer install --no-dev --optimize-autoloader -q 2>&1');
}
// 3. Migrations SQL
$pdo->exec('CREATE TABLE IF NOT EXISTS schema_migrations (name TEXT NOT NULL PRIMARY KEY, applied_at TIMESTAMP NOT NULL DEFAULT NOW())');
$_sqlApplied = array_flip($pdo->query('SELECT name FROM schema_migrations ORDER BY name')->fetchAll(PDO::FETCH_COLUMN));
$_sqlFiles = glob(BASE_PATH . '/database/migration_*.sql') ?: [];
sort($_sqlFiles);
foreach ($_sqlFiles as $_sqlFile) {
$_sqlName = basename($_sqlFile);
if (isset($_sqlApplied[$_sqlName])) {
continue;
}
$pdo->exec((string) file_get_contents($_sqlFile));
$pdo->prepare('INSERT INTO schema_migrations (name) VALUES (:n)')->execute([':n' => $_sqlName]);
}
// 4. Migrations de contenu
$_cmDataDir = DATA_PATH;
$_cmTrack = $_cmDataDir . '/.content_migrations.json';
$_cmFlag = $_cmDataDir . '/.maintenance';
$_cmApplied = file_exists($_cmTrack) ? (json_decode((string) file_get_contents($_cmTrack), true) ?? []) : [];
$_cmFiles = glob(BASE_PATH . '/scripts/content/migration_*.php') ?: [];
sort($_cmFiles);
$_cmPending = array_values(array_filter($_cmFiles, fn ($f) => !isset($_cmApplied[basename($f)])));
$_cmErrors = 0;
if (!empty($_cmPending)) {
file_put_contents($_cmFlag, date('Y-m-d H:i:s'));
$dataDir = $_cmDataDir;
foreach ($_cmPending as $_cmFile) {
try {
require $_cmFile;
$_cmApplied[basename($_cmFile)] = date('Y-m-d H:i:s');
file_put_contents($_cmTrack, json_encode($_cmApplied, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) . "\n");
} catch (Throwable $_cmEx) {
$_cmErrors++;
break;
}
}
if (file_exists($_cmFlag)) {
unlink($_cmFlag);
}
}
$_updateChecker->clearCache();
header('Location: /admin?tab=dashboard&notice=' . ($_cmErrors ? 'update_content_error' : 'engine_updated'));
exit;
case 'force_update_check': case 'force_update_check':
requireAuth(); requireAuth();
if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') { if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') {
@@ -2826,6 +2903,20 @@ switch ($action) {
header('Location: /admin?tab=dashboard'); header('Location: /admin?tab=dashboard');
exit; exit;
case 'admin_save_folio_config':
requireAuth();
if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(403);
exit;
}
$ok = saveSiteSettings([
'folio_repo_url' => $_POST['folio_repo_url'] ?? '',
'folio_update_branch' => $_POST['folio_update_branch'] ?? '',
]);
$_updateChecker->clearCache();
header('Location: /admin/site?notice=' . ($ok ? 'folio_saved' : 'folio_error'));
exit;
case 'admin_save_site': case 'admin_save_site':
requireAuth(); requireAuth();
if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') { if (!isAdmin() || $_SERVER['REQUEST_METHOD'] !== 'POST') {
+1 -1
View File
@@ -1 +1 @@
1.5.0 1.6.0
+1 -1
View File
@@ -24,7 +24,7 @@ fi
BRANCH=$(git rev-parse --abbrev-ref HEAD) BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH" == "main" ]]; then if [[ "$BRANCH" == "main" ]]; then
echo "✗ Refus de pousser directement sur main." echo "✗ Refus de pousser directement sur main."
echo " Créer une branche feature : git checkout -b feat/nom" echo " Travailler sur 'dev' ou une branche feature : git checkout dev"
exit 1 exit 1
fi fi
+19 -1
View File
@@ -68,6 +68,24 @@ function apacheAccessLog(): string
return (string)($_ENV['APACHE_ACCESS_LOG'] ?? getenv('APACHE_ACCESS_LOG') ?: '*-access.log'); return (string)($_ENV['APACHE_ACCESS_LOG'] ?? getenv('APACHE_ACCESS_LOG') ?: '*-access.log');
} }
function folioRepoUrl(): string
{
$fromSettings = siteSettings()['folio_repo_url'] ?? '';
if ($fromSettings !== '') {
return rtrim($fromSettings, '/');
}
return rtrim((string)($_ENV['FOLIO_REPO_URL'] ?? getenv('FOLIO_REPO_URL') ?: ''), '/');
}
function folioUpdateBranch(): string
{
$fromSettings = siteSettings()['folio_update_branch'] ?? '';
if ($fromSettings !== '') {
return $fromSettings;
}
return (string)($_ENV['FOLIO_UPDATE_BRANCH'] ?? getenv('FOLIO_UPDATE_BRANCH') ?: 'main');
}
/** @return list<array{label:string,patterns:list<string>}> */ /** @return list<array{label:string,patterns:list<string>}> */
function asGroups(): array function asGroups(): array
{ {
@@ -78,7 +96,7 @@ function asGroups(): array
function saveSiteSettings(array $data): bool function saveSiteSettings(array $data): bool
{ {
$current = siteSettings(); $current = siteSettings();
$stringKeys = ['site_title', 'site_claim', 'site_lang', 'site_license_label', 'site_license_url', 'apache_access_log']; $stringKeys = ['site_title', 'site_claim', 'site_lang', 'site_license_label', 'site_license_url', 'apache_access_log', 'folio_repo_url', 'folio_update_branch'];
foreach ($stringKeys as $key) { foreach ($stringKeys as $key) {
if (array_key_exists($key, $data)) { if (array_key_exists($key, $data)) {
$val = trim((string)$data[$key]); $val = trim((string)$data[$key]);
+2 -2
View File
@@ -67,7 +67,7 @@ class UpdateChecker
*/ */
private function checkRemoteVersion(): ?string private function checkRemoteVersion(): ?string
{ {
$repoUrl = rtrim((string) ($_ENV['FOLIO_REPO_URL'] ?? getenv('FOLIO_REPO_URL') ?: ''), '/'); $repoUrl = folioRepoUrl();
if ($repoUrl === '') { if ($repoUrl === '') {
return null; return null;
} }
@@ -91,7 +91,7 @@ class UpdateChecker
public function getBranch(): string public function getBranch(): string
{ {
return (string) ($_ENV['FOLIO_UPDATE_BRANCH'] ?? getenv('FOLIO_UPDATE_BRANCH') ?: 'main'); return folioUpdateBranch();
} }
public function getLastChecked(): ?int public function getLastChecked(): ?int
+54 -22
View File
@@ -106,6 +106,7 @@ function adminStatusBadge(array $a, int $now): string
$_notices = isset($_updateChecker) ? $_updateChecker->adminNotices() : []; $_notices = isset($_updateChecker) ? $_updateChecker->adminNotices() : [];
$_branch = isset($_updateChecker) ? $_updateChecker->getBranch() : 'main'; $_branch = isset($_updateChecker) ? $_updateChecker->getBranch() : 'main';
$_lastChecked = isset($_updateChecker) ? $_updateChecker->getLastChecked() : null; $_lastChecked = isset($_updateChecker) ? $_updateChecker->getLastChecked() : null;
$_repoConfigured = folioRepoUrl() !== '';
$_remoteLabel = '—'; $_remoteLabel = '—';
foreach ($_notices as $_n) { foreach ($_notices as $_n) {
if ($_n['type'] === 'info' && preg_match('/v([\d]+\.[\d]+\.[\d]+)/', $_n['message'], $_m)) { if ($_n['type'] === 'info' && preg_match('/v([\d]+\.[\d]+\.[\d]+)/', $_n['message'], $_m)) {
@@ -125,34 +126,38 @@ function adminStatusBadge(array $a, int $now): string
<tr> <tr>
<th class="text-muted fw-normal ps-0 pe-2 text-nowrap">Dernière version disponible</th> <th class="text-muted fw-normal ps-0 pe-2 text-nowrap">Dernière version disponible</th>
<td class="d-flex align-items-center gap-2 flex-wrap"> <td class="d-flex align-items-center gap-2 flex-wrap">
<span><?= htmlspecialchars($_remoteLabel) ?><?= $_remoteLabel !== '—' && $_remoteLabel !== $_deployedLabel ? ' <span class="badge bg-warning text-dark ms-1">Mise à jour disponible</span>' : '' ?></span> <span><?= htmlspecialchars($_remoteLabel) ?></span>
<form method="POST" action="/?action=force_update_check" class="d-inline"> <?php if ($_remoteLabel !== '—' && $_remoteLabel !== $_deployedLabel): ?>
<button type="submit" class="btn btn-outline-secondary btn-sm py-0">Vérifier</button> <form method="POST" action="/?action=run_engine_update" class="d-inline">
</form> <button type="submit" class="btn btn-primary btn-sm">Mettre à jour vers v<?= htmlspecialchars($_remoteLabel) ?></button>
</form>
<?php elseif ($_repoConfigured): ?>
<form method="POST" action="/?action=force_update_check" class="d-inline">
<button type="submit" class="btn btn-outline-secondary btn-sm py-0">Vérifier</button>
</form>
<?php else: ?>
<span class="text-muted small">(<code>FOLIO_REPO_URL</code> non configuré)</span>
<?php endif; ?>
</td> </td>
</tr> </tr>
<tr> <tr>
<th class="text-muted fw-normal ps-0 pe-2 text-nowrap">Branche suivie</th> <th class="text-muted fw-normal ps-0 pe-2 text-nowrap">Branche suivie</th>
<td><code><?= htmlspecialchars($_branch) ?></code><?= $_lastChecked !== null ? ' <span class="text-muted ms-2">· vérifié le ' . date('d/m/Y à H:i', $_lastChecked) . '</span>' : '' ?></td> <td><code><?= htmlspecialchars($_branch) ?></code><?= $_lastChecked !== null ? ' <span class="text-muted ms-2">· vérifié le ' . date('d/m/Y à H:i', $_lastChecked) . '</span>' : '' ?></td>
</tr> </tr>
<?php if (!empty($_notices)): ?> <?php if (($_GET['notice'] ?? '') === 'engine_updated'): ?>
<tr> <tr><td colspan="2"><div class="alert alert-success py-1 mb-0 small">Moteur mis à jour avec succès (code, base de données, contenu).</div></td></tr>
<th class="text-muted fw-normal ps-0 pe-2 align-top">Actions requises</th> <?php elseif (($_GET['notice'] ?? '') === 'update_git_error'): ?>
<td class="d-flex flex-wrap gap-2 align-items-center"> <tr><td colspan="2">
<?php foreach ($_notices as $_n): ?> <div class="alert alert-danger py-1 mb-0 small">
<?php if ($_n['type'] === 'warning'): ?> Erreur git pull — vérifiez les droits d'accès au dépôt.
<form method="POST" action="/?action=run_content_migrations"> <?php if (!empty($_SESSION['_update_log'])): ?>
<button type="submit" class="btn btn-warning btn-sm">Mettre à jour le contenu</button> <pre class="mt-1 mb-0 small"><?= htmlspecialchars($_SESSION['_update_log']) ?></pre>
</form> <?php unset($_SESSION['_update_log']); ?>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> </div>
</td> </td></tr>
</tr> <?php elseif (($_GET['notice'] ?? '') === 'update_content_error'): ?>
<?php endif; ?> <tr><td colspan="2"><div class="alert alert-warning py-1 mb-0 small">Code et base de données mis à jour, mais une migration de contenu a échoué.</div></td></tr>
<?php if (($_GET['notice'] ?? '') === 'migrated'): ?>
<tr><td colspan="2"><div class="alert alert-success py-1 mb-0 small">Migrations appliquées avec succès.</div></td></tr>
<?php elseif (($_GET['notice'] ?? '') === 'migration_error'): ?>
<tr><td colspan="2"><div class="alert alert-danger py-1 mb-0 small">Une erreur est survenue pendant la migration.</div></td></tr>
<?php endif; ?> <?php endif; ?>
</tbody> </tbody>
</table> </table>
@@ -542,6 +547,33 @@ function adminStatusBadge(array $a, int $now): string
</div> </div>
</div> </div>
<?php if (($_GET['notice'] ?? '') === 'folio_saved'): ?>
<div class="alert alert-success py-2 mt-3 small">Configuration Folio enregistrée.</div>
<?php elseif (($_GET['notice'] ?? '') === 'folio_error'): ?>
<div class="alert alert-danger py-2 mt-3 small">Impossible d'enregistrer.</div>
<?php endif; ?>
<div class="card mt-4" style="max-width:540px">
<div class="card-header bg-transparent py-2 small fw-semibold">Mises à jour du moteur</div>
<div class="card-body">
<form method="POST" action="/?action=admin_save_folio_config">
<div class="mb-3">
<label class="form-label small fw-semibold mb-1">URL du dépôt Folio</label>
<input type="url" name="folio_repo_url" class="form-control form-control-sm font-monospace"
placeholder="https://git.abonnel.fr/cedricAbonnel/folio"
value="<?= htmlspecialchars(folioRepoUrl()) ?>">
<div class="form-text">Sans slash final. Laissez vide pour utiliser <code>FOLIO_REPO_URL</code> du .env.</div>
</div>
<div class="mb-3">
<label class="form-label small fw-semibold mb-1">Branche suivie</label>
<input type="text" name="folio_update_branch" class="form-control form-control-sm font-monospace"
placeholder="main"
value="<?= htmlspecialchars(folioUpdateBranch()) ?>">
</div>
<button type="submit" class="btn btn-primary btn-sm">Enregistrer</button>
</form>
</div>
</div>
<?php endif; ?> <?php endif; ?>
<!-- ─────────────────────────── CATÉGORIES & TAGS ─────────────────── --> <!-- ─────────────────────────── CATÉGORIES & TAGS ─────────────────── -->