step5.php 18 KB

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