diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php
index b841edb12ac..27bce2d8e57 100644
--- a/htdocs/install/step5.php
+++ b/htdocs/install/step5.php
@@ -220,9 +220,9 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."
";
$success = 1;
} else {
- if ($newuser->error == 'ErrorLoginAlreadyExists') {
+ if ($result == -6) { //login or email already exists
dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
- print '
'.$langs->trans("AdminLoginAlreadyExists", $login)."
";
+ print '
'.$newuser->error."
";
$success = 1;
} else {
dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
@@ -357,48 +357,50 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
// Create lock file
// If first install
-if ($action == "set" && $success) {
- if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
- // Install is finished
- print $langs->trans("SystemIsInstalled")."
";
+if ($action == "set") {
+ if ($success) {
+ if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
+ // Install is finished
+ print $langs->trans("SystemIsInstalled")."
";
- $createlock = 0;
+ $createlock = 0;
- if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
- // Install is finished, we create the lock file
- $lockfile = DOL_DATA_ROOT.'/install.lock';
- $fp = @fopen($lockfile, "w");
- if ($fp) {
- if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
- $force_install_lockinstall = 444; // For backward compatibility
+ if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
+ // Install is finished, we create the lock file
+ $lockfile = DOL_DATA_ROOT.'/install.lock';
+ $fp = @fopen($lockfile, "w");
+ if ($fp) {
+ if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
+ $force_install_lockinstall = 444; // For backward compatibility
+ }
+ fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
+ fclose($fp);
+ @chmod($lockfile, octdec($force_install_lockinstall));
+ $createlock = 1;
}
- fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
- fclose($fp);
- @chmod($lockfile, octdec($force_install_lockinstall));
- $createlock = 1;
}
+ if (empty($createlock)) {
+ print ''.$langs->trans("WarningRemoveInstallDir")."
";
+ }
+
+ print "
";
+
+ print $langs->trans("YouNeedToPersonalizeSetup")."
";
+
+ print '';
+ } else {
+ // If here MAIN_VERSION_LAST_UPGRADE is not empty
+ print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
';
+ print $langs->trans("VersionProgram").': '.DOL_VERSION.'
';
+ print $langs->trans("MigrationNotFinished").'
';
+ print "
";
+
+ print '';
}
- if (empty($createlock)) {
- print ''.$langs->trans("WarningRemoveInstallDir")."
";
- }
-
- print "
";
-
- print $langs->trans("YouNeedToPersonalizeSetup")."
";
-
- print '';
- } else {
- // If here MAIN_VERSION_LAST_UPGRADE is not empty
- print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
';
- print $langs->trans("VersionProgram").': '.DOL_VERSION.'
';
- print $langs->trans("MigrationNotFinished").'
';
- print "
";
-
- print '';
}
} elseif (empty($action) || preg_match('/upgrade/i', $action)) {
// If upgrade
@@ -443,7 +445,7 @@ if ($action == "set" && $success) {
$morehtml .= '';
}
} else {
- dol_print_error('', 'step5.php: unknown choice of action');
+ dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
}
// Clear cache files