From be4960cfbb3ff3c3e75ddfffd8073a0999604f33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 5 Aug 2012 00:46:10 +0200 Subject: [PATCH] Fix: exit code when upgrade is ran from command line --- htdocs/install/upgrade.php | 6 +++++- htdocs/install/upgrade2.php | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index 22c69ac4f99..b89c3e2e291 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -351,10 +351,14 @@ if (empty($actiondone)) print '
'.$langs->trans("ErrorWrongParameters").'
'; } +$ret=0; +if (! $ok && isset($argv[1])) $ret=1; +dol_syslog("Exit ".$ret); + pFooter(! $ok && empty($_GET["ignoreerrors"]),$setuplang); if ($db->connected) $db->close(); // Return code if ran from command line -if (! $ok && isset($argv[1])) exit(1); +if ($ret) exit($ret); ?> \ No newline at end of file diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 7efaca24306..f7ea05e2ed1 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -341,13 +341,16 @@ else $error++; } +$ret=0; +if ($error && isset($argv[1])) $ret=1; +dol_syslog("Exit ".$ret); pFooter($error,$setuplang); if ($db->connected) $db->close(); // Return code if ran from command line -if ($error && isset($argv[1])) exit(1); +if ($ret) exit($ret);