dolibarr  x.y.z
step5.php
Go to the documentation of this file.
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 
29 include_once 'inc.php';
30 if (file_exists($conffile)) {
31  include_once $conffile;
32 }
33 require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php';
34 require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; // for dol_hash
35 
36 global $langs;
37 
38 $versionfrom = GETPOST("versionfrom", 'alpha', 3) ?GETPOST("versionfrom", 'alpha', 3) : (empty($argv[1]) ? '' : $argv[1]);
39 $versionto = GETPOST("versionto", 'alpha', 3) ?GETPOST("versionto", 'alpha', 3) : (empty($argv[2]) ? '' : $argv[2]);
40 $setuplang = GETPOST('selectlang', 'aZ09', 3) ?GETPOST('selectlang', 'aZ09', 3) : (empty($argv[3]) ? 'auto' : $argv[3]);
41 $langs->setDefaultLang($setuplang);
42 $action = GETPOST('action', 'alpha') ?GETPOST('action', 'alpha') : (empty($argv[4]) ? '' : $argv[4]);
43 
44 // Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
45 // or MAIN_VERSION_LAST_UPGRADE for upgrade.
46 $targetversion = DOL_VERSION; // If it's latest upgrade
47 if (!empty($action) && preg_match('/upgrade/i', $action)) {
48  // If it's an old upgrade
49  $tmp = explode('_', $action, 2);
50  if ($tmp[0] == 'upgrade') {
51  if (!empty($tmp[1])) {
52  $targetversion = $tmp[1]; // if $action = 'upgrade_6.0.0-beta', we use '6.0.0-beta'
53  } else {
54  $targetversion = DOL_VERSION; // if $action = 'upgrade', we use DOL_VERSION
55  }
56  }
57 }
58 
59 $langs->loadLangs(array("admin", "install"));
60 
61 $login = GETPOST('login', 'alpha') ?GETPOST('login', 'alpha') : (empty($argv[5]) ? '' : $argv[5]);
62 $pass = GETPOST('pass', 'alpha') ?GETPOST('pass', 'alpha') : (empty($argv[6]) ? '' : $argv[6]);
63 $pass_verif = GETPOST('pass_verif', 'alpha') ?GETPOST('pass_verif', 'alpha') : (empty($argv[7]) ? '' : $argv[7]);
64 $force_install_lockinstall = (int) (!empty($force_install_lockinstall) ? $force_install_lockinstall : (GETPOST('installlock', 'aZ09') ?GETPOST('installlock', 'aZ09') : (empty($argv[8]) ? '' : $argv[8])));
65 
66 $success = 0;
67 
68 $useforcedwizard = false;
69 $forcedfile = "./install.forced.php";
70 if ($conffile == "/etc/dolibarr/conf.php") {
71  $forcedfile = "/etc/dolibarr/install.forced.php";
72 }
73 if (@file_exists($forcedfile)) {
74  $useforcedwizard = true;
75  include_once $forcedfile;
76  // If forced install is enabled, replace post values. These are empty because form fields are disabled.
77  if ($force_install_noedit == 2) {
78  if (!empty($force_install_dolibarrlogin)) {
79  $login = $force_install_dolibarrlogin;
80  }
81  }
82 }
83 
84 dolibarr_install_syslog("- step5: entering step5.php page");
85 
86 $error = 0;
87 
88 /*
89  * Actions
90  */
91 
92 // If install, check password and password_verification used to create admin account
93 if ($action == "set") {
94  if ($pass <> $pass_verif) {
95  header("Location: step4.php?error=1&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
96  exit;
97  }
98 
99  if (dol_strlen(trim($pass)) == 0) {
100  header("Location: step4.php?error=2&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
101  exit;
102  }
103 
104  if (dol_strlen(trim($login)) == 0) {
105  header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
106  exit;
107  }
108 }
109 
110 
111 /*
112  * View
113  */
114 
115 $morehtml = '';
116 
117 pHeader($langs->trans("SetupEnd"), "step5", 'set', '', '', 'main-inside main-inside-borderbottom');
118 print '<br>';
119 
120 // Test if we can run a first install process
121 if (empty($versionfrom) && empty($versionto) && !is_writable($conffile)) {
122  print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
123  pFooter(1, $setuplang, 'jscheckparam');
124  exit;
125 }
126 
127 if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) {
128  $error = 0;
129 
130  // If password is encoded, we decode it
131  if ((!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) || !empty($dolibarr_main_db_encrypted_pass)) {
132  require_once $dolibarr_main_document_root.'/core/lib/security.lib.php';
133  if (!empty($dolibarr_main_db_pass) && preg_match('/crypted:/i', $dolibarr_main_db_pass)) {
134  $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass);
135  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass);
136  $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
137  } else {
138  $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass);
139  }
140  }
141 
142  $conf->db->type = $dolibarr_main_db_type;
143  $conf->db->host = $dolibarr_main_db_host;
144  $conf->db->port = $dolibarr_main_db_port;
145  $conf->db->name = $dolibarr_main_db_name;
146  $conf->db->user = $dolibarr_main_db_user;
147  $conf->db->pass = $dolibarr_main_db_pass;
148  $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption) ? $dolibarr_main_db_encryption : '';
149  $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $dolibarr_main_db_cryptkey : '';
150 
151  $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
152 
153  // Create the global $hookmanager object
154  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
155  $hookmanager = new HookManager($db);
156 
157  $ok = 0;
158 
159  // If first install
160  if ($action == "set") {
161  // Active module user
162  $modName = 'modUser';
163  $file = $modName.".class.php";
164  dolibarr_install_syslog('step5: load module user '.DOL_DOCUMENT_ROOT."/core/modules/".$file, LOG_INFO);
165  include_once DOL_DOCUMENT_ROOT."/core/modules/".$file;
166  $objMod = new $modName($db);
167  $result = $objMod->init();
168  if (!$result) {
169  print "ERROR: failed to init module file = ".$file;
170  }
171 
172  if ($db->connected) {
173  $conf->setValues($db);
174  // Reset forced setup after the setValues
175  if (defined('SYSLOG_FILE')) {
176  $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
177  }
178  $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
179 
180  // Create admin user
181  include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php';
182 
183  // Set default encryption to yes, generate a salt and set default encryption algorythm (but only if there is no user yet into database)
184  $sql = "SELECT u.rowid, u.pass, u.pass_crypted";
185  $sql .= " FROM ".MAIN_DB_PREFIX."user as u";
186  $resql = $db->query($sql);
187  if ($resql) {
188  $numrows = $db->num_rows($resql);
189  if ($numrows == 0) {
190  // Define default setup for password encryption
191  dolibarr_set_const($db, "DATABASE_PWD_ENCRYPTED", "1", 'chaine', 0, '', $conf->entity);
192  dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities
193  if (function_exists('password_hash')) {
194  dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities
195  } else {
196  dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities
197  }
198  }
199 
200  dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO);
201  }
202 
203  // Create user used to create the admin user
204  $createuser = new User($db);
205  $createuser->id = 0;
206  $createuser->admin = 1;
207 
208  // Set admin user
209  $newuser = new User($db);
210  $newuser->lastname = 'SuperAdmin';
211  $newuser->firstname = '';
212  $newuser->login = $login;
213  $newuser->pass = $pass;
214  $newuser->admin = 1;
215  $newuser->entity = 0;
216 
217  $conf->global->USER_MAIL_REQUIRED = 0; // Force global option to be sure to create a new user with no email
218  $conf->global->USER_PASSWORD_GENERATED = ''; // To not use any rule for password validation
219 
220  $result = $newuser->create($createuser, 1);
221  if ($result > 0) {
222  print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."<br>";
223  $success = 1;
224  } else {
225  if ($result == -6) { //login or email already exists
226  dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING);
227  print '<br><div class="warning">'.$newuser->error."</div><br>";
228  $success = 1;
229  } else {
230  dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR);
231  setEventMessages($langs->trans("FailedToCreateAdminLogin").' '.$newuser->error, null, 'errors');
232  //header("Location: step4.php?error=3&selectlang=$setuplang".(isset($login) ? '&login='.$login : ''));
233  print '<br><div class="error">'.$langs->trans("FailedToCreateAdminLogin").': '.$newuser->error.'</div><br><br>';
234  print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
235  }
236  }
237 
238  if ($success) {
239  // 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.
240  $db->begin();
241  dolibarr_install_syslog('step5: set MAIN_VERSION_FIRST_INSTALL const to '.$targetversion, LOG_DEBUG);
242  $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)");
243  if ($resql) {
244  $conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion;
245  $db->commit();
246  } else {
247  //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists
248  $db->commit();
249  }
250 
251  $db->begin();
252 
253  dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_INSTALL const to '.$targetversion, LOG_DEBUG);
254  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_VERSION_LAST_INSTALL'");
255  if (!$resql) {
256  dol_print_error($db, 'Error in setup program');
257  }
258  $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)");
259  if (!$resql) {
260  dol_print_error($db, 'Error in setup program');
261  }
262  $conf->global->MAIN_VERSION_LAST_INSTALL = $targetversion;
263 
264  if ($useforcedwizard) {
265  dolibarr_install_syslog('step5: set MAIN_REMOVE_INSTALL_WARNING const to 1', LOG_DEBUG);
266  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_REMOVE_INSTALL_WARNING'");
267  if (!$resql) {
268  dol_print_error($db, 'Error in setup program');
269  }
270  // The install.lock file is created few lines later if version is last one or if option MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE is on
271  /* No need to enable this
272  $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)");
273  if (!$resql) {
274  dol_print_error($db, 'Error in setup program');
275  }
276  $conf->global->MAIN_REMOVE_INSTALL_WARNING = 1;
277  */
278  }
279 
280  // If we ask to force some modules to be enabled
281  if (!empty($force_install_module)) {
282  if (!defined('DOL_DOCUMENT_ROOT') && !empty($dolibarr_main_document_root)) {
283  define('DOL_DOCUMENT_ROOT', $dolibarr_main_document_root);
284  }
285 
286  $tmparray = explode(',', $force_install_module);
287  foreach ($tmparray as $modtoactivate) {
288  $modtoactivatenew = preg_replace('/\.class\.php$/i', '', $modtoactivate);
289  print $langs->trans("ActivateModule", $modtoactivatenew).'<br>';
290 
291  $file = $modtoactivatenew.'.class.php';
292  dolibarr_install_syslog('step5: activate module file='.$file);
293  $res = dol_include_once("/core/modules/".$file);
294 
295  $res = activateModule($modtoactivatenew, 1);
296  if (!empty($res['errors'])) {
297  print 'ERROR: failed to activateModule() file='.$file;
298  }
299  }
300  }
301 
302  dolibarr_install_syslog('step5: remove MAIN_NOT_INSTALLED const');
303  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_NOT_INSTALLED'");
304  if (!$resql) {
305  dol_print_error($db, 'Error in setup program');
306  }
307 
308  $db->commit();
309  }
310  } else {
311  print $langs->trans("ErrorFailedToConnect")."<br>";
312  }
313  } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
314  // If upgrade
315  if ($db->connected) {
316  $conf->setValues($db);
317  // Reset forced setup after the setValues
318  if (defined('SYSLOG_FILE')) {
319  $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE');
320  }
321  $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
322 
323  // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database
324  $tagdatabase = false;
325  if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) {
326  $tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed.
327  } else {
328  $mainversionlastupgradearray = preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE);
329  $targetversionarray = preg_split('/[.-]/', $targetversion);
330  if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) {
331  $tagdatabase = true;
332  }
333  }
334 
335  if ($tagdatabase) {
336  dolibarr_install_syslog('step5: set MAIN_VERSION_LAST_UPGRADE const to value '.$targetversion);
337  $resql = $db->query("DELETE FROM ".MAIN_DB_PREFIX."const WHERE ".$db->decrypt('name')." = 'MAIN_VERSION_LAST_UPGRADE'");
338  if (!$resql) {
339  dol_print_error($db, 'Error in setup program');
340  }
341  $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)");
342  if (!$resql) {
343  dol_print_error($db, 'Error in setup program');
344  }
345  $conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion;
346  } else {
347  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.');
348  }
349  } else {
350  print $langs->trans("ErrorFailedToConnect")."<br>";
351  }
352  } else {
353  dol_print_error('', 'step5.php: unknown choice of action');
354  }
355 
356  // May fail if parameter already defined
357  $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)");
358  //if (! $resql) dol_print_error($db,'Error in setup program');
359 
360  $db->close();
361 }
362 
363 
364 
365 // Create lock file
366 
367 // If first install
368 if ($action == "set") {
369  if ($success) {
370  if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
371  // Install is finished
372  print '<br>'.$langs->trans("SystemIsInstalled")."<br>";
373 
374  $createlock = 0;
375 
376  if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
377  // Install is finished, we create the lock file
378  $lockfile = DOL_DATA_ROOT.'/install.lock';
379  $fp = @fopen($lockfile, "w");
380  if ($fp) {
381  if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
382  $force_install_lockinstall = 444; // For backward compatibility
383  }
384  fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
385  fclose($fp);
386  @chmod($lockfile, octdec($force_install_lockinstall));
387  $createlock = 1;
388  }
389  }
390  if (empty($createlock)) {
391  print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
392  }
393 
394  print "<br>";
395 
396  print $langs->trans("YouNeedToPersonalizeSetup")."<br><br><br>";
397 
398  print '<div class="center">&gt; <a href="../admin/index.php?mainmenu=home&leftmenu=setup'.(isset($login) ? '&username='.urlencode($login) : '').'">';
399  print '<span class="fas fa-external-link-alt"></span> '.$langs->trans("GoToSetupArea");
400  print '</a></div><br>';
401  } else {
402  // If here MAIN_VERSION_LAST_UPGRADE is not empty
403  print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
404  print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b><br>';
405  print $langs->trans("MigrationNotFinished").'<br>';
406  print "<br>";
407 
408  print '<div class="center"><a href="'.$dolibarr_main_url_root.'/install/index.php">';
409  print '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
410  print '</a></div>';
411  }
412  }
413 } elseif (empty($action) || preg_match('/upgrade/i', $action)) {
414  // If upgrade
415  if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION)) {
416  // Upgrade is finished
417  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>";
418 
419  $createlock = 0;
420 
421  if (!empty($force_install_lockinstall) || !empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE)) {
422  // Upgrade is finished, we create the lock file
423  $lockfile = DOL_DATA_ROOT.'/install.lock';
424  $fp = @fopen($lockfile, "w");
425  if ($fp) {
426  if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) {
427  $force_install_lockinstall = 444; // For backward compatibility
428  }
429  fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
430  fclose($fp);
431  @chmod($lockfile, octdec($force_install_lockinstall));
432  $createlock = 1;
433  }
434  }
435  if (empty($createlock)) {
436  print '<br><div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
437  }
438 
439  print "<br>";
440 
441  $morehtml = '<br><div class="center"><a href="../index.php?mainmenu=home'.(isset($login) ? '&username='.urlencode($login) : '').'">';
442  $morehtml .= '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToDolibarr").'...';
443  $morehtml .= '</a></div><br>';
444  } else {
445  // If here MAIN_VERSION_LAST_UPGRADE is not empty
446  print $langs->trans("VersionLastUpgrade").': <b><span class="ok">'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</span></b><br>';
447  print $langs->trans("VersionProgram").': <b><span class="ok">'.DOL_VERSION.'</span></b>';
448 
449  print "<br>";
450 
451  $morehtml = '<br><div class="center"><a href="../install/index.php">';
452  $morehtml .= '<span class="fas fa-link-alt"></span> '.$langs->trans("GoToUpgradePage");
453  $morehtml .= '</a></div>';
454  }
455 } else {
456  dol_print_error('', 'step5.php: unknown choice of action='.$action.' in create lock file seaction');
457 }
458 
459 // Clear cache files
460 clearstatcache();
461 
462 $ret = 0;
463 if ($error && isset($argv[1])) {
464  $ret = 1;
465 }
466 dolibarr_install_syslog("Exit ".$ret);
467 
468 dolibarr_install_syslog("- step5: Dolibarr setup finished");
469 
470 pFooter(1, $setuplang, '', 0, $morehtml);
471 
472 // Return code if ran from command line
473 if ($ret) {
474  exit($ret);
475 }
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
Definition: admin.lib.php:632
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays).
Definition: admin.lib.php:66
activateModule($value, $withdeps=1)
Enable a module.
Definition: admin.lib.php:1091
Class to manage hooks.
Class to manage Dolibarr users.
Definition: user.class.php:45
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname='')
Make an include_once using default root and alternate root if it fails.
dol_now($mode='auto')
Return date for now.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition: inc.php:401
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition: inc.php:490
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition: inc.php:551
dol_decode($chain, $key='1')
Decode a base 64 encoded + specific delta change.