diff --git a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php index 6bd70a62decdb3a1a74fb5c5d7e76530868f1d37..e0cf002f1efd25c18899e86b084fd407d78df490 100755 --- a/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php +++ b/apps/maarch_entreprise/class/class_business_app_tools_Abstract.php @@ -593,8 +593,8 @@ abstract class business_app_tools_Abstract extends Database $xmlBase = simplexml_load_file($xmlVersionBase); //Find value in the xml database_version tag if ($xmlBase) { - $_SESSION['maarch_entreprise'] - ['xml_versionbase'] = (string) $xmlBase->version; + $versions = explode('.', (string)$xmlBase->version); + $_SESSION['maarch_entreprise']['xml_versionbase'] = "{$versions[0]}.{$versions[1]}"; } else { $_SESSION['maarch_entreprise']['xml_versionbase'] = 'none'; } diff --git a/sql/develop.sql b/sql/develop.sql index aa4746dd4713f246d9e268744b7328a94722b38a..301348594cf3e3bd08adb906ba6a0000a31e9d7f 100755 --- a/sql/develop.sql +++ b/sql/develop.sql @@ -5,7 +5,7 @@ -- -- -- -- -- *************************************************************************-- -UPDATE parameters SET param_value_string = '19.10.1' WHERE id = 'database_version'; +UPDATE parameters SET param_value_string = '19.12' WHERE id = 'database_version'; ALTER TABLE notif_email_stack ALTER COLUMN attachments TYPE text; diff --git a/src/app/versionUpdate/controllers/VersionUpdateController.php b/src/app/versionUpdate/controllers/VersionUpdateController.php index 057e0e0e8d58fadb0eaaf15fa1c0d1d453b56eeb..50f8fd6575936d0c965e67477c58f7007dd2ae65 100755 --- a/src/app/versionUpdate/controllers/VersionUpdateController.php +++ b/src/app/versionUpdate/controllers/VersionUpdateController.php @@ -89,14 +89,15 @@ class VersionUpdateController } $output = []; - $diff = exec('git diff 2>&1', $output); - $stagedDiff = exec('git diff --staged 2>&1', $output); + exec('git diff 2>&1', $output); + exec('git diff --staged 2>&1', $output); return $response->withJson([ 'lastAvailableMinorVersion' => $lastAvailableMinorVersion, 'lastAvailableMajorVersion' => $lastAvailableMajorVersion, 'currentVersion' => $currentVersion, - 'canUpdate' => empty($output) && empty($diff) && empty($stagedDiff) + 'canUpdate' => empty($output), + 'diffOutput' => $output, ]); } @@ -157,11 +158,15 @@ class VersionUpdateController $output = []; exec('git fetch'); - exec("git checkout {$minorVersion} 2>&1", $output); + exec("git checkout {$minorVersion} 2>&1", $output, $returnCode); - $log = "Application updated from {$currentVersion} to {$minorVersion}\nCheckout response => " . implode(' ', $output) . "\n"; + $log = "Application update from {$currentVersion} to {$minorVersion}\nCheckout response {$returnCode} => " . implode(' ', $output) . "\n"; file_put_contents('updateVersion.log', $log, FILE_APPEND); + if ($returnCode != 0) { + return $response->withStatus(400)->withJson(['errors' => 'Application update failed. Please check updateVersion.log at root application']); + } + return $response->withStatus(204); } }