release 1.6.0 : bouton Mettre à jour, branche dev, guard git pull #69

Merged
cedricAbonnel merged 4 commits from dev into main 2026-05-15 09:21:52 +00:00
Showing only changes of commit eddde2165a - Show all commits
+12 -1
View File
@@ -2823,7 +2823,18 @@ switch ($action) {
exit;
}
// 1. git pull
// 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);