diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index 78d29584a30..81700c14824 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -219,12 +219,22 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action)) if ($success) { + // Insert MAIN_VERSION_FIRST_INSTALL in a dedicated transaction. So if it fails (when first install was already done), we can do other following requests. $db->begin(); - dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to ' . $targetversion, LOG_DEBUG); $resql=$db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL',1).",".$db->encrypt($targetversion,1).",'chaine',0,'Dolibarr version when first install',0)"); - //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists - $conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion; + if ($resql) + { + $conf->global->MAIN_VERSION_FIRST_INSTALL=$targetversion; + $db->commit(); + } + else + { + //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists + $db->commit(); + } + + $db->begin(); dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to ' . $targetversion, LOG_DEBUG); $resql=$db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_VERSION_LAST_INSTALL'");