step5.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  1. <?php
  2. /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  3. * Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
  4. * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
  5. * Copyright (C) 2004 Sebastien DiCintio <sdicintio@ressource-toi.org>
  6. * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
  7. * Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  21. */
  22. /**
  23. * \file htdocs/install/step5.php
  24. * \ingroup install
  25. * \brief Last page of upgrade / install process
  26. */
  27. include_once 'inc.php';
  28. if (file_exists($conffile)) {
  29. include_once $conffile;
  30. }
  31. require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
  32. require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash
  33. global $langs;
  34. $versionfrom = GETPOST("versionfrom", 'alpha', 3) ?GETPOST("versionfrom", 'alpha', 3) : (empty($argv[1]) ? '' : $argv[1]);
  35. $versionto = GETPOST("versionto", 'alpha', 3) ?GETPOST("versionto", 'alpha', 3) : (empty($argv[2]) ? '' : $argv[2]);
  36. $setuplang = GETPOST('selectlang', 'aZ09', 3) ?GETPOST('selectlang', 'aZ09', 3) : (empty($argv[3]) ? 'auto' : $argv[3]);
  37. $langs->setDefaultLang($setuplang);
  38. $action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : (empty($argv[4]) ? '' : $argv[4]);
  39. // Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
  40. // or MAIN_VERSION_LAST_UPGRADE for upgrade.
  41. $targetversion = DOL_VERSION; // If it's latest upgrade
  42. if (!empty($action) && preg_match('/upgrade/i', $action)) {
  43. // If it's an old upgrade
  44. $tmp = explode('_', $action, 2);
  45. if ($tmp[0] == 'upgrade') {
  46. if (!empty($tmp[1])) {
  47. $targetversion = $tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta'
  48. } else {
  49. $targetversion = DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION
  50. }
  51. }
  52. }
  53. $langs->loadLangs(array("admin", "install"));
  54. $login = GETPOST('login', 'alpha') ?GETPOST('login', 'alpha') : (empty($argv[5]) ? '' : $argv[5]);
  55. $pass = GETPOST('pass', 'alpha') ?GETPOST('pass', 'alpha') : (empty($argv[6]) ? '' : $argv[6]);
  56. $pass_verif = GETPOST('pass_verif', 'alpha') ?GETPOST('pass_verif', 'alpha') : (empty($argv[7]) ? '' : $argv[7]);
  57. $force_install_lockinstall = (int) (!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ?GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8])));
  58. $success = 0;
  59. $useforcedwizard = false;
  60. $forcedfile = "./install.forced.php";
  61. if ($conffile == "/etc/dolibarr/conf.php") {
  62. $forcedfile = "/etc/dolibarr/install.forced.php";
  63. }
  64. if (@file_exists($forcedfile)) {
  65. $useforcedwizard = true;
  66. include_once $forcedfile;
  67. // If forced install is enabled, replace post values. These are empty because form fields are disabled.
  68. if ($force_install_noedit == 2) {
  69. if (!empty($force_install_dolibarrlogin)) {
  70. $login = $force_install_dolibarrlogin;
  71. }
  72. }
  73. }
  74. dolibarr_install_syslog("- step5: entering step5.php page");
  75. $error = 0;
  76. /*
  77. * Actions
  78. */
  79. // If install, check password and password_verification used to create admin account
  80. if ($action == "set") {
  81. if ($pass <> $pass_verif) {
  82. header("Location: step4.php?error=1&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
  83. exit;
  84. }
  85. if (dol_strlen(trim($pass)) == 0) {
  86. header("Location: step4.php?error=2&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
  87. exit;
  88. }
  89. if (dol_strlen(trim($login)) == 0) {
  90. header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
  91. exit;
  92. }
  93. }
  94. /*
  95. * View
  96. */
  97. $morehtml = '';
  98. pHeader($langs->trans("SetupEnd"), "step5", 'set', '', '', 'main-inside main-inside-borderbottom');
  99. print '<br>';
  100. // Test if we can run a first install process
  101. if (empty($versionfrom) && empty($versionto) && !is_writable($conffile)) {
  102. print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
  103. pFooter(1, $setuplang, 'jscheckparam');
  104. exit;
  105. }
  106. if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
  107. $error = 0;
  108. // If password is encoded, we decode it
  109. if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) {
  110. require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
  111. if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) {
  112. $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
  113. $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass);
  114. $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted
  115. } else {
  116. $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
  117. }
  118. }
  119. $conf->db->type = $dolibarr_main_db_type;
  120. $conf->db->host = $dolibarr_main_db_host;
  121. $conf->db->port = $dolibarr_main_db_port;
  122. $conf->db->name = $dolibarr_main_db_name;
  123. $conf->db->user = $dolibarr_main_db_user;
  124. $conf->db->pass = $dolibarr_main_db_pass;
  125. $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption) ? $dolibarr_main_db_encryption : '';
  126. $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $dolibarr_main_db_cryptkey : '';
  127. $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
  128. // Create the global $hookmanager object
  129. include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
  130. $hookmanager = new HookManager($db);
  131. $ok = 0;
  132. // If first install
  133. if ($action == "set") {
  134. // Active module user
  135. $modName = 'modUser';
  136. $file = $modName.".class.php";
  137. dolibarr_install_syslog('step5: load module user '.DOL_DOCUMENT_ROOT."/core/modules/".$file, LOG_INFO);
  138. include_once DOL_DOCUMENT_ROOT."/core/modules/".$file;
  139. $objMod = new $modName($db);
  140. $result = $objMod->init();
  141. if (!$result) {
  142. print "ERROR: failed to init module file = ".$file;
  143. }
  144. if ($db->connected) {
  145. $conf->setValues($db);
  146. // Reset forced setup after the setValues
  147. if (defined('SYSLOG_FILE')) {
  148. $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
  149. }
  150. $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
  151. // Create admin user
  152. include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
  153. // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database)
  154. $sql = "SELECT u.rowid, u.pass, u.pass_crypted";
  155. $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
  156. $resql = $db->query($sql);
  157. if ($resql) {
  158. $numrows = $db->num_rows($resql);
  159. if ($numrows == 0) {
  160. // Define default setup for password encryption
  161. dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
  162. dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities
  163. if (function_exists('password_hash')) {
  164. dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities
  165. } else {
  166. dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
  167. }
  168. }
  169. dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
  170. }
  171. // Create user used to create the admin user
  172. $createuser = new User($db);
  173. $createuser->id = 0;
  174. $createuser->admin = 1;
  175. // Set admin user
  176. $newuser = new User($db);
  177. $newuser->lastname = 'SuperAdmin';
  178. $newuser->firstname = '';
  179. $newuser->login = $login;
  180. $newuser->pass = $pass;
  181. $newuser->admin = 1;
  182. $newuser->entity = 0;
  183. $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email
  184. $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation
  185. $result = $newuser->create($createuser, 1);
  186. if ($result > 0) {
  187. print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
  188. $success = 1;
  189. } else {
  190. if ($result == -6) { //login or email already exists
  191. dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
  192. print '<br><div class="warning">'.$newuser->error."</div><br>";
  193. $success = 1;
  194. } else {
  195. dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
  196. setEventMessages($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors');
  197. //header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
  198. print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").': '.$newuser->error.'</div><br><br>';
  199. print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
  200. }
  201. }
  202. if ($success) {
  203. // 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.
  204. $db->begin();
  205. dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to '.$targetversion, LOG_DEBUG);
  206. $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) values(".$db->encrypt('MAIN_VERSION_FIRST_INSTALL').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version when first install', 0)");
  207. if ($resql) {
  208. $conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion;
  209. $db->commit();
  210. } else {
  211. //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
  212. $db->commit();
  213. }
  214. $db->begin();
  215. dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG);
  216. $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_VERSION_LAST_INSTALL'");
  217. if (!$resql) {
  218. dol_print_error($db, 'Error in setup program');
  219. }
  220. $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_VERSION_LAST_INSTALL').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version when last install', 0)");
  221. if (!$resql) {
  222. dol_print_error($db, 'Error in setup program');
  223. }
  224. $conf->global->MAIN_VERSION_LAST_INSTALL = $targetversion;
  225. if ($useforcedwizard) {
  226. dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
  227. $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_REMOVE_INSTALL_WARNING'");
  228. if (!$resql) {
  229. dol_print_error($db, 'Error in setup program');
  230. }
  231. $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) values(".$db->encrypt('MAIN_REMOVE_INSTALL_WARNING').", ".$db->encrypt(1).", 'chaine', 1, 'Disable install warnings', 0)");
  232. if (!$resql) {
  233. dol_print_error($db, 'Error in setup program');
  234. }
  235. $conf->global->MAIN_REMOVE_INSTALL_WARNING = 1;
  236. }
  237. // If we ask to force some modules to be enabled
  238. if (!empty($force_install_module)) {
  239. if (!defined('DOL_DOCUMENT_ROOT') && !empty($dolibarr_main_document_root)) {
  240. define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
  241. }
  242. $tmparray = explode(',', $force_install_module);
  243. foreach ($tmparray as $modtoactivate) {
  244. $modtoactivatenew = preg_replace('/\.class\.php$/i', '', $modtoactivate);
  245. print $langs->trans("ActivateModule", $modtoactivatenew).'<br>';
  246. $file = $modtoactivatenew.'.class.php';
  247. dolibarr_install_syslog('step5: activate module file='.$file);
  248. $res = dol_include_once("/core/modules/".$file);
  249. $res = activateModule($modtoactivatenew, 1);
  250. if (!empty($res['errors'])) {
  251. print 'ERROR: failed to activateModule() file='.$file;
  252. }
  253. }
  254. }
  255. dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
  256. $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')."='MAIN_NOT_INSTALLED'");
  257. if (!$resql) {
  258. dol_print_error($db, 'Error in setup program');
  259. }
  260. $db->commit();
  261. }
  262. } else {
  263. print $langs->trans("ErrorFailedToConnect")."<br>";
  264. }
  265. } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
  266. // If upgrade
  267. if ($db->connected) {
  268. $conf->setValues($db);
  269. // Reset forced setup after the setValues
  270. if (defined('SYSLOG_FILE')) {
  271. $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
  272. }
  273. $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
  274. // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database
  275. $tagdatabase = false;
  276. if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
  277. $tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed.
  278. } else {
  279. $mainversionlastupgradearray = preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE);
  280. $targetversionarray = preg_split('/[.-]/', $targetversion);
  281. if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) {
  282. $tagdatabase = true;
  283. }
  284. }
  285. if ($tagdatabase) {
  286. dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion);
  287. $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_VERSION_LAST_UPGRADE'");
  288. if (!$resql) {
  289. dol_print_error($db, 'Error in setup program');
  290. }
  291. $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name, value, type, visible, note, entity) VALUES (".$db->encrypt('MAIN_VERSION_LAST_UPGRADE').", ".$db->encrypt($targetversion).", 'chaine', 0, 'Dolibarr version for last upgrade', 0)");
  292. if (!$resql) {
  293. dol_print_error($db, 'Error in setup program');
  294. }
  295. $conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion;
  296. } else {
  297. dolibarr_install_syslog('step5: we run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.');
  298. }
  299. } else {
  300. print $langs->trans("ErrorFailedToConnect")."<br>";
  301. }
  302. } else {
  303. dol_print_error('', 'step5.php: unknown choice of action');
  304. }
  305. // May fail if parameter already defined
  306. $resql = $db->query("INSERT INTO ".MAIN_DB_PREFIX."const(name,value,type,visible,note,entity) VALUES (".$db->encrypt('MAIN_LANG_DEFAULT').", ".$db->encrypt($setuplang).", 'chaine', 0, 'Default language', 1)");
  307. //if (! $resql) dol_print_error($db,'Error in setup program');
  308. $db->close();
  309. }
  310. // Create lock file
  311. // If first install
  312. if ($action == "set") {
  313. if ($success) {
  314. if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
  315. // Install is finished
  316. print '<br>'.$langs->trans("SystemIsInstalled")."<br>";
  317. $createlock = 0;
  318. if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
  319. // Install is finished, we create the lock file
  320. $lockfile = DOL_DATA_ROOT.'/install.lock';
  321. $fp = @fopen($lockfile, "w");
  322. if ($fp) {
  323. if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
  324. $force_install_lockinstall = 444; // For backward compatibility
  325. }
  326. fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
  327. fclose($fp);
  328. @chmod($lockfile, octdec($force_install_lockinstall));
  329. $createlock = 1;
  330. }
  331. }
  332. if (empty($createlock)) {
  333. print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
  334. }
  335. print "<br>";
  336. print $langs->trans("YouNeedToPersonalizeSetup")."<br><br><br>";
  337. print '<div class="center">&gt; <a href="../admin/index.php?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">';
  338. print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
  339. print '</a></div><br>';
  340. } else {
  341. // If here MAIN_VERSION_LAST_UPGRADE is not empty
  342. print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
  343. print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
  344. print $langs->trans("MigrationNotFinished").'<br>';
  345. print "<br>";
  346. print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">';
  347. print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
  348. print '</a></div>';
  349. }
  350. }
  351. } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
  352. // If upgrade
  353. if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
  354. // Upgrade is finished
  355. print '<img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/checklist.svg" width="20" alt="Configuration"> <span class="valignmiddle">'.$langs->trans("SystemIsUpgraded")."</span><br>";
  356. $createlock = 0;
  357. if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
  358. // Upgrade is finished, we create the lock file
  359. $lockfile = DOL_DATA_ROOT.'/install.lock';
  360. $fp = @fopen($lockfile, "w");
  361. if ($fp) {
  362. if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
  363. $force_install_lockinstall = 444; // For backward compatibility
  364. }
  365. fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
  366. fclose($fp);
  367. @chmod($lockfile, octdec($force_install_lockinstall));
  368. $createlock = 1;
  369. }
  370. }
  371. if (empty($createlock)) {
  372. print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
  373. }
  374. print "<br>";
  375. $morehtml = '<br><div class="center"><a href="../index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">';
  376. $morehtml .= '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToDolibarr").'...';
  377. $morehtml .= '</a></div><br>';
  378. } else {
  379. // If here MAIN_VERSION_LAST_UPGRADE is not empty
  380. print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
  381. print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
  382. print "<br>";
  383. $morehtml = '<br><div class="center"><a href="../install/index.php">';
  384. $morehtml .= '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
  385. $morehtml .= '</a></div>';
  386. }
  387. } else {
  388. dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
  389. }
  390. // Clear cache files
  391. clearstatcache();
  392. $ret = 0;
  393. if ($error && isset($argv[1])) {
  394. $ret = 1;
  395. }
  396. dolibarr_install_syslog("Exit ".$ret);
  397. dolibarr_install_syslog("- step5: Dolibarr setup finished");
  398. pFooter(1, $setuplang, '', 0, $morehtml);
  399. // Return code if ran from command line
  400. if ($ret) {
  401. exit($ret);
  402. }