dolibarr 19.0.4
step1.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2004-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3 * Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
5 * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
6 * Copyright (C) 2005-2011 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
29define('DONOTLOADCONF', 1); // To avoid loading conf by file inc.php
30
31include 'inc.php';
32
33global $langs;
34
35$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]);
36$setuplang = GETPOST('selectlang', 'aZ09', 3) ? GETPOST('selectlang', 'aZ09', 3) : (empty($argv[2]) ? 'auto' : $argv[2]);
37$langs->setDefaultLang($setuplang);
38
39$langs->loadLangs(array("admin", "install", "errors"));
40
41// Dolibarr pages directory
42$main_dir = GETPOST('main_dir') ? GETPOST('main_dir') : (empty($argv[3]) ? '' : $argv[3]);
43// Directory for generated documents (invoices, orders, ecm, etc...)
44$main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : (empty($argv[4]) ? ($main_dir.'/documents') : $argv[4]);
45// Dolibarr root URL
46$main_url = GETPOST('main_url') ? GETPOST('main_url') : (empty($argv[5]) ? '' : $argv[5]);
47// Database login information
48$userroot = GETPOST('db_user_root', 'alpha') ? GETPOST('db_user_root', 'alpha') : (empty($argv[6]) ? '' : $argv[6]);
49$passroot = GETPOST('db_pass_root', 'none') ? GETPOST('db_pass_root', 'none') : (empty($argv[7]) ? '' : $argv[7]);
50// Database server
51$db_type = GETPOST('db_type', 'aZ09') ? GETPOST('db_type', 'aZ09') : (empty($argv[8]) ? '' : $argv[8]);
52$db_host = GETPOST('db_host', 'alpha') ? GETPOST('db_host', 'alpha') : (empty($argv[9]) ? '' : $argv[9]);
53$db_name = GETPOST('db_name', 'aZ09') ? GETPOST('db_name', 'aZ09') : (empty($argv[10]) ? '' : $argv[10]);
54$db_user = GETPOST('db_user', 'alpha') ? GETPOST('db_user', 'alpha') : (empty($argv[11]) ? '' : $argv[11]);
55$db_pass = GETPOST('db_pass', 'none') ? GETPOST('db_pass', 'none') : (empty($argv[12]) ? '' : $argv[12]);
56$db_port = GETPOST('db_port', 'int') ? GETPOST('db_port', 'int') : (empty($argv[13]) ? '' : $argv[13]);
57$db_prefix = GETPOST('db_prefix', 'aZ09') ? GETPOST('db_prefix', 'aZ09') : (empty($argv[14]) ? '' : $argv[14]);
58$db_create_database = GETPOST('db_create_database', 'alpha') ? GETPOST('db_create_database', 'alpha') : (empty($argv[15]) ? '' : $argv[15]);
59$db_create_user = GETPOST('db_create_user', 'alpha') ? GETPOST('db_create_user', 'alpha') : (empty($argv[16]) ? '' : $argv[16]);
60// Force https
61$main_force_https = ((GETPOST("main_force_https", 'alpha') && (GETPOST("main_force_https", 'alpha') == "on" || GETPOST("main_force_https", 'alpha') == 1)) ? '1' : '0');
62// Use alternative directory
63$main_use_alt_dir = ((GETPOST("main_use_alt_dir", 'alpha') == '' || (GETPOST("main_use_alt_dir", 'alpha') == "on" || GETPOST("main_use_alt_dir", 'alpha') == 1)) ? '' : '//');
64// Alternative root directory name
65$main_alt_dir_name = ((GETPOST("main_alt_dir_name", 'alpha') && GETPOST("main_alt_dir_name", 'alpha') != '') ? GETPOST("main_alt_dir_name", 'alpha') : 'custom');
66
67$dolibarr_main_distrib = 'standard';
68
69session_start(); // To be able to keep info into session (used for not losing password during navigation. The password must not transit through parameters)
70
71// Save a flag to tell to restore input value if we go back
72$_SESSION['dol_save_pass'] = $db_pass;
73//$_SESSION['dol_save_passroot']=$passroot;
74
75// Now we load forced values from install.forced.php file.
76$useforcedwizard = false;
77$forcedfile = "./install.forced.php";
78if ($conffile == "/etc/dolibarr/conf.php") {
79 $forcedfile = "/etc/dolibarr/install.forced.php";
80}
81if (@file_exists($forcedfile)) {
82 $useforcedwizard = true;
83 include_once $forcedfile;
84 // If forced install is enabled, replace the post values. These are empty because form fields are disabled.
85 if ($force_install_noedit) {
87 if (!empty($argv[3])) {
88 $main_dir = $argv[3]; // override when executing the script in command line
89 }
90 if (!empty($force_install_main_data_root)) {
91 $main_data_dir = $force_install_main_data_root;
92 } else {
93 $main_data_dir = detect_dolibarr_main_data_root($main_dir);
94 }
95 if (!empty($argv[4])) {
96 $main_data_dir = $argv[4]; // override when executing the script in command line
97 }
99 if (!empty($argv[5])) {
100 $main_url = $argv[5]; // override when executing the script in command line
101 }
102
103 if (!empty($force_install_databaserootlogin)) {
104 $userroot = parse_database_login($force_install_databaserootlogin);
105 }
106 if (!empty($argv[6])) {
107 $userroot = $argv[6]; // override when executing the script in command line
108 }
109 if (!empty($force_install_databaserootpass)) {
110 $passroot = parse_database_pass($force_install_databaserootpass);
111 }
112 if (!empty($argv[7])) {
113 $passroot = $argv[7]; // override when executing the script in command line
114 }
115 }
116 if ($force_install_noedit == 2) {
117 if (!empty($force_install_type)) {
118 $db_type = $force_install_type;
119 }
120 if (!empty($force_install_dbserver)) {
121 $db_host = $force_install_dbserver;
122 }
123 if (!empty($force_install_database)) {
124 $db_name = $force_install_database;
125 }
126 if (!empty($force_install_databaselogin)) {
127 $db_user = $force_install_databaselogin;
128 }
129 if (!empty($force_install_databasepass)) {
130 $db_pass = $force_install_databasepass;
131 }
132 if (!empty($force_install_port)) {
133 $db_port = $force_install_port;
134 }
135 if (!empty($force_install_prefix)) {
136 $db_prefix = $force_install_prefix;
137 }
138 if (!empty($force_install_createdatabase)) {
139 $db_create_database = $force_install_createdatabase;
140 }
141 if (!empty($force_install_createuser)) {
142 $db_create_user = $force_install_createuser;
143 }
144 if (!empty($force_install_mainforcehttps)) {
145 $main_force_https = $force_install_mainforcehttps;
146 }
147 }
148
149 if (!empty($force_install_distrib)) {
150 $dolibarr_main_distrib = $force_install_distrib;
151 }
152}
153
154
155$error = 0;
156
157
158/*
159 * View
160 */
161
162dolibarr_install_syslog("--- step1: entering step1.php page");
163
164pHeader($langs->trans("ConfigurationFile"), "step2");
165
166// Test if we can run a first install process
167if (!is_writable($conffile)) {
168 print $langs->trans("ConfFileIsNotWritable", $conffiletoshow);
169 pFooter(1, $setuplang, 'jscheckparam');
170 exit;
171}
172
173
174// Check parameters
175$is_sqlite = false;
176if (empty($db_type)) {
177 print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseType")).'</div>';
178 $error++;
179} else {
180 $is_sqlite = ($db_type === 'sqlite' || $db_type === 'sqlite3');
181}
182if (empty($db_host) && !$is_sqlite) {
183 print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("Server")).'</div>';
184 $error++;
185}
186if (empty($db_name)) {
187 print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("DatabaseName")).'</div>';
188 $error++;
189}
190if (empty($db_user) && !$is_sqlite) {
191 print '<div class="error">'.$langs->trans("ErrorFieldRequired", $langs->transnoentities("Login")).'</div>';
192 $error++;
193}
194if (!empty($db_port) && !is_numeric($db_port)) {
195 print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $db_port, $langs->transnoentities("Port")).'</div>';
196 $error++;
197}
198if (!empty($db_prefix) && !preg_match('/^[a-z0-9]+_$/i', $db_prefix)) {
199 print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $db_prefix, $langs->transnoentities("DatabasePrefix")).'</div>';
200 $error++;
201}
202
203
204// Remove last / into dans main_dir
205if (substr($main_dir, dol_strlen($main_dir) - 1) == "/") {
206 $main_dir = substr($main_dir, 0, dol_strlen($main_dir) - 1);
207}
208
209// Remove last / into dans main_url
210if (!empty($main_url) && substr($main_url, dol_strlen($main_url) - 1) == "/") {
211 $main_url = substr($main_url, 0, dol_strlen($main_url) - 1);
212}
213
214if (!dol_is_dir($main_dir.'/core/db/')) {
215 print '<div class="error">'.$langs->trans("ErrorBadValueForParameter", $main_dir, $langs->transnoentitiesnoconv("WebPagesDirectory")).'</div>';
216 print '<br>';
217 //print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
218 print $langs->trans("ErrorGoBackAndCorrectParameters");
219 $error++;
220}
221
222// Test database connection
223if (!$error) {
224 $result = @include_once $main_dir."/core/db/".$db_type.'.class.php';
225 if ($result) {
226 // If we require database or user creation we need to connect as root, so we need root login credentials
227 if (!empty($db_create_database) && !$userroot) {
228 print '<div class="error">'.$langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $db_name).'</div>';
229 print '<br>';
230 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
231 print $langs->trans("ErrorGoBackAndCorrectParameters");
232 $error++;
233 }
234 if (!empty($db_create_user) && !$userroot) {
235 print '<div class="error">'.$langs->trans("YouAskLoginCreationSoDolibarrNeedToConnect", $db_user).'</div>';
236 print '<br>';
237 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
238 print $langs->trans("ErrorGoBackAndCorrectParameters");
239 $error++;
240 }
241
242 // If we need root access
243 if (!$error && (!empty($db_create_database) || !empty($db_create_user))) {
244 $databasefortest = $db_name;
245 if (!empty($db_create_database)) {
246 if ($db_type == 'mysql' || $db_type == 'mysqli') {
247 $databasefortest = 'mysql';
248 } elseif ($db_type == 'pgsql') {
249 $databasefortest = 'postgres';
250 } else {
251 $databasefortest = 'master';
252 }
253 }
254
255 $db = getDoliDBInstance($db_type, $db_host, $userroot, $passroot, $databasefortest, (int) $db_port);
256
257 dol_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG);
258 //print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
259
260 if (empty($db_create_database) && $db->connected && !$db->database_selected) {
261 print '<div class="error">'.$langs->trans("ErrorConnectedButDatabaseNotFound", $db_name).'</div>';
262 print '<br>';
263 if (!$db->connected) {
264 print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate").'<br><br>';
265 }
266 print $langs->trans("ErrorGoBackAndCorrectParameters");
267 $error++;
268 } elseif ($db->error && !(!empty($db_create_database) && $db->connected)) {
269 // Note: you may experience error here with message "No such file or directory" when mysql was installed for the first time but not yet launched.
270 if ($db->error == "No such file or directory") {
271 print '<div class="error">'.$langs->trans("ErrorToConnectToMysqlCheckInstance").'</div>';
272 } else {
273 print '<div class="error">'.$db->error.'</div>';
274 }
275 if (!$db->connected) {
276 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
277 }
278 //print '<a href="#" onClick="javascript: history.back();">';
279 print $langs->trans("ErrorGoBackAndCorrectParameters");
280 //print '</a>';
281 $error++;
282 }
283 }
284
285 // If we need simple access
286 if (!$error && (empty($db_create_database) && empty($db_create_user))) {
287 $db = getDoliDBInstance($db_type, $db_host, $db_user, $db_pass, $db_name, (int) $db_port);
288
289 if ($db->error) {
290 print '<div class="error">'.$db->error.'</div>';
291 if (!$db->connected) {
292 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
293 }
294 //print '<a href="#" onClick="javascript: history.back();">';
295 print $langs->trans("ErrorGoBackAndCorrectParameters");
296 //print '</a>';
297 $error++;
298 }
299 }
300 } else {
301 print "<br>\nFailed to include_once(\"".$main_dir."/core/db/".$db_type.".class.php\")<br>\n";
302 print '<div class="error">'.$langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")).'</div>';
303 //print '<a href="#" onClick="javascript: history.back();">';
304 print $langs->trans("ErrorGoBackAndCorrectParameters");
305 //print '</a>';
306 $error++;
307 }
308} else {
309 if (isset($db)) {
310 print $db->lasterror();
311 }
312 if (isset($db) && !$db->connected) {
313 print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
314 }
315 print $langs->trans("ErrorGoBackAndCorrectParameters");
316 $error++;
317}
318
319if (!$error && $db->connected) {
320 if (!empty($db_create_database)) {
321 $result = $db->select_db($db_name);
322 if ($result) {
323 print '<div class="error">'.$langs->trans("ErrorDatabaseAlreadyExists", $db_name).'</div>';
324 print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate").'<br><br>';
325 print $langs->trans("ErrorGoBackAndCorrectParameters");
326 $error++;
327 }
328 }
329}
330
331// Define $defaultCharacterSet and $defaultDBSortingCollation
332if (!$error && $db->connected) {
333 if (!empty($db_create_database)) { // If we create database, we force default value
334 // Default values come from the database handler
335
336 $defaultCharacterSet = $db->forcecharset;
337 $defaultDBSortingCollation = $db->forcecollate;
338 } else { // If already created, we take current value
339 $defaultCharacterSet = $db->getDefaultCharacterSetDatabase();
340 $defaultDBSortingCollation = $db->getDefaultCollationDatabase();
341 }
342
343 // It seems some PHP driver mysqli does not support utf8mb3
344 if ($defaultCharacterSet == 'utf8mb3' || $defaultDBSortingCollation == 'utf8mb3_unicode_ci') {
345 $defaultCharacterSet = 'utf8';
346 $defaultDBSortingCollation = 'utf8_unicode_ci';
347 }
348 // Force to avoid utf8mb4 because index on field char 255 reach limit of 767 char for indexes (example with mysql 5.6.34 = mariadb 10.0.29)
349 // TODO Remove this when utf8mb4 is supported
350 if ($defaultCharacterSet == 'utf8mb4' || $defaultDBSortingCollation == 'utf8mb4_unicode_ci') {
351 $defaultCharacterSet = 'utf8';
352 $defaultDBSortingCollation = 'utf8_unicode_ci';
353 }
354
355 print '<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.'">';
356 print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
357 $db_character_set = $defaultCharacterSet;
358 $db_collation = $defaultDBSortingCollation;
359 dolibarr_install_syslog("step1: db_character_set=".$db_character_set." db_collation=".$db_collation);
360}
361
362
363// Create config file
364if (!$error && $db->connected && $action == "set") {
365 umask(0);
366 if (is_array($_POST)) {
367 foreach ($_POST as $key => $value) {
368 if (!preg_match('/^db_pass/i', $key)) {
369 dolibarr_install_syslog("step1: choice for ".$key." = ".$value);
370 }
371 }
372 }
373
374 // Show title of step
375 print '<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans("ConfigurationFile").'</h3>';
376 print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
377
378 // Check parameter main_dir
379 if (!$error) {
380 if (!is_dir($main_dir)) {
381 dolibarr_install_syslog("step1: directory '".$main_dir."' is unavailable or can't be accessed");
382
383 print "<tr><td>";
384 print $langs->trans("ErrorDirDoesNotExists", $main_dir).'<br>';
385 print $langs->trans("ErrorWrongValueForParameter", $langs->transnoentitiesnoconv("WebPagesDirectory")).'<br>';
386 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
387 print '</td><td>';
388 print $langs->trans("Error");
389 print "</td></tr>";
390 $error++;
391 }
392 }
393
394 if (!$error) {
395 dolibarr_install_syslog("step1: directory '".$main_dir."' exists");
396 }
397
398
399 // Create subdirectory main_data_dir
400 if (!$error) {
401 // Create directory for documents
402 if (!is_dir($main_data_dir)) {
403 dol_mkdir($main_data_dir);
404 }
405
406 if (!is_dir($main_data_dir)) {
407 print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
408 print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
409 print '</td><td>';
410 print '<span class="error">'.$langs->trans("Error").'</span>';
411 print "</td></tr>";
412 print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
413 $error++;
414 } else {
415 // Create .htaccess file in document directory
416 $pathhtaccess = $main_data_dir.'/.htaccess';
417 if (!file_exists($pathhtaccess)) {
418 dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '".$main_data_dir."'");
419 $handlehtaccess = @fopen($pathhtaccess, 'w');
420 if ($handlehtaccess) {
421 fwrite($handlehtaccess, 'Order allow,deny'."\n");
422 fwrite($handlehtaccess, 'Deny from all'."\n");
423
424 fclose($handlehtaccess);
425 dolibarr_install_syslog("step1: .htaccess file created");
426 }
427 }
428
429 // Documents are stored above the web pages root to prevent being downloaded without authentification
430 $dir = array();
431 $dir[] = $main_data_dir."/mycompany";
432 $dir[] = $main_data_dir."/medias";
433 $dir[] = $main_data_dir."/users";
434 $dir[] = $main_data_dir."/facture";
435 $dir[] = $main_data_dir."/propale";
436 $dir[] = $main_data_dir."/ficheinter";
437 $dir[] = $main_data_dir."/produit";
438 $dir[] = $main_data_dir."/doctemplates";
439
440 // Loop on each directory of dir [] to create them if they do not exist
441 $num = count($dir);
442 for ($i = 0; $i < $num; $i++) {
443 if (is_dir($dir[$i])) {
444 dolibarr_install_syslog("step1: directory '".$dir[$i]."' exists");
445 } else {
446 if (dol_mkdir($dir[$i]) < 0) {
447 print "<tr><td>";
448 print "Failed to create directory: ".$dir[$i];
449 print '</td><td>';
450 print $langs->trans("Error");
451 print "</td></tr>";
452 $error++;
453 } else {
454 dolibarr_install_syslog("step1: directory '".$dir[$i]."' created");
455 }
456 }
457 }
458
459 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
460
461 // Copy directory medias
462 $srcroot = $main_dir.'/install/medias';
463 $destroot = $main_data_dir.'/medias';
464 dolCopyDir($srcroot, $destroot, 0, 0);
465
466 if ($error) {
467 print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
468 print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
469 print '</td><td>';
470 print '<span class="error">'.$langs->trans("Error").'</span>';
471 print "</td></tr>";
472 print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
473 } else {
474 //ODT templates
475 $srcroot = $main_dir.'/install/doctemplates';
476 $destroot = $main_data_dir.'/doctemplates';
477 $docs = array(
478 'contracts' => 'contract',
479 'invoices' => 'invoice',
480 'orders' => 'order',
481 'products' => 'product',
482 'projects' => 'project',
483 'proposals' => 'proposal',
484 'shipments' => 'shipment',
485 'supplier_proposals' => 'supplier_proposal',
486 'tasks' => 'task_summary',
487 'thirdparties' => 'thirdparty',
488 'usergroups' => 'usergroups',
489 'users' => 'user',
490 );
491 foreach ($docs as $cursordir => $cursorfile) {
492 $src = $srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt';
493 $dirodt = $destroot.'/'.$cursordir;
494 $dest = $dirodt.'/template_'.$cursorfile.'.odt';
495
496 dol_mkdir($dirodt);
497 $result = dol_copy($src, $dest, 0, 0);
498 if ($result < 0) {
499 print '<tr><td colspan="2"><br>'.$langs->trans('ErrorFailToCopyFile', $src, $dest).'</td></tr>';
500 }
501 }
502 }
503 }
504 }
505
506 // Table prefix
507 $main_db_prefix = (!empty($db_prefix) ? $db_prefix : 'llx_');
508
509 // Write conf file on disk
510 if (!$error) {
511 // Save old conf file on disk
512 if (file_exists("$conffile")) {
513 // We must ignore errors as an existing old file may already exist and not be replaceable or
514 // the installer (like for ubuntu) may not have permission to create another file than conf.php.
515 // Also no other process must be able to read file or we expose the new file, so content with password.
516 @dol_copy($conffile, $conffile.'.old', '0400');
517 }
518
519 $error += write_conf_file($conffile);
520 }
521
522 // Create database and admin user database
523 if (!$error) {
524 // We reload configuration file
525 conf($dolibarr_main_document_root);
526
527 print '<tr><td>';
528 print $langs->trans("ConfFileReload");
529 print '</td>';
530 print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
531
532 // Create database user if requested
533 if (isset($db_create_user) && ($db_create_user == "1" || $db_create_user == "on")) {
534 dolibarr_install_syslog("step1: create database user: ".$dolibarr_main_db_user);
535
536 //print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port;
537 $databasefortest = $conf->db->name;
538 if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') {
539 $databasefortest = 'mysql';
540 } elseif ($conf->db->type == 'pgsql') {
541 $databasefortest = 'postgres';
542 } elseif ($conf->db->type == 'mssql') {
543 $databasefortest = 'master';
544 }
545
546 // Check database connection
547
548 $db = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, $databasefortest, (int) $conf->db->port);
549
550 if ($db->error) {
551 print '<div class="error">'.$db->error.'</div>';
552 $error++;
553 }
554
555 if (!$error) {
556 if ($db->connected) {
557 $resultbis = 1;
558
559 if (empty($dolibarr_main_db_pass)) {
560 dolibarr_install_syslog("step1: failed to create user, password is empty", LOG_ERR);
561 print '<tr><td>';
562 print $langs->trans("UserCreation").' : ';
563 print $dolibarr_main_db_user;
564 print '</td>';
565 print '<td>'.$langs->trans("Error").": A password for database user is mandatory.</td></tr>";
566 } else {
567 // Create user
568 $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
569
570 // Create user bis
571 if ($databasefortest == 'mysql') {
572 if (!in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) {
573 $resultbis = $db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
574 }
575 }
576
577 if ($result > 0 && $resultbis > 0) {
578 print '<tr><td>';
579 print $langs->trans("UserCreation").' : ';
580 print $dolibarr_main_db_user;
581 print '</td>';
582 print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
583 } else {
584 if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
585 || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
586 || $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS') {
587 dolibarr_install_syslog("step1: user already exists");
588 print '<tr><td>';
589 print $langs->trans("UserCreation").' : ';
590 print $dolibarr_main_db_user;
591 print '</td>';
592 print '<td>'.$langs->trans("LoginAlreadyExists").'</td></tr>';
593 } else {
594 dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
595 print '<tr><td>';
596 print $langs->trans("UserCreation").' : ';
597 print $dolibarr_main_db_user;
598 print '</td>';
599 print '<td>'.$langs->trans("Error").': '.$db->errno().' '.$db->error().($db->error ? '. '.$db->error : '')."</td></tr>";
600 }
601 }
602 }
603
604 $db->close();
605 } else {
606 print '<tr><td>';
607 print $langs->trans("UserCreation").' : ';
608 print $dolibarr_main_db_user;
609 print '</td>';
610 print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
611 print '</tr>';
612
613 // warning message due to connection failure
614 print '<tr><td colspan="2"><br>';
615 print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
616 print '<br>';
617 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
618 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
619 print '</td></tr>';
620
621 $error++;
622 }
623 }
624 } // end of user account creation
625
626
627 // If database creation was asked, we create it
628 if (!$error && (isset($db_create_database) && ($db_create_database == "1" || $db_create_database == "on"))) {
629 dolibarr_install_syslog("step1: create database: ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user);
630 $newdb = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, '', (int) $conf->db->port);
631 //print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
632
633 if ($newdb->connected) {
634 $result = $newdb->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_db_user);
635
636 if ($result) {
637 print '<tr><td>';
638 print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
639 print $dolibarr_main_db_name;
640 print '</td>';
641 print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
642
643 $newdb->select_db($dolibarr_main_db_name);
644 $check1 = $newdb->getDefaultCharacterSetDatabase();
645 $check2 = $newdb->getDefaultCollationDatabase();
646 dolibarr_install_syslog('step1: new database is using charset='.$check1.' collation='.$check2);
647
648 // If values differs, we save conf file again
649 //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING);
650 //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
651 } else {
652 // warning message
653 print '<tr><td colspan="2"><br>';
654 print $langs->trans("ErrorFailedToCreateDatabase", $dolibarr_main_db_name).'<br>';
655 print $newdb->lasterror().'<br>';
656 print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate");
657 print '<br>';
658 print '</td></tr>';
659
660 dolibarr_install_syslog('step1: failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR);
661 $error++;
662 }
663 $newdb->close();
664 } else {
665 print '<tr><td>';
666 print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
667 print $dolibarr_main_db_name;
668 print '</td>';
669 print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
670 print '</tr>';
671
672 // warning message
673 print '<tr><td colspan="2"><br>';
674 print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
675 print '<br>';
676 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
677 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
678 print '</td></tr>';
679
680 $error++;
681 }
682 } // end of create database
683
684
685 // We test access with dolibarr database user (not admin)
686 if (!$error) {
687 dolibarr_install_syslog("step1: connection type=".$conf->db->type." on host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name);
688 //print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
689
690 $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
691
692 if ($db->connected) {
693 dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." ok");
694 print "<tr><td>";
695 print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
696 print $dolibarr_main_db_host;
697 print "</td><td>";
698 print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
699 print "</td></tr>";
700
701 // server access ok, basic access ok
702 if ($db->database_selected) {
703 dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." ok");
704 print "<tr><td>";
705 print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
706 print $dolibarr_main_db_name;
707 print "</td><td>";
708 print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
709 print "</td></tr>";
710
711 $error = 0;
712 } else {
713 dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." failed", LOG_ERR);
714 print "<tr><td>";
715 print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
716 print $dolibarr_main_db_name;
717 print '</td><td>';
718 print '<img src="../theme/eldy/img/error.png" alt="Error">';
719 print "</td></tr>";
720
721 // warning message
722 print '<tr><td colspan="2"><br>';
723 print $langs->trans('CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name).'<br>';
724 print $langs->trans('IfAlreadyExistsCheckOption').'<br>';
725 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
726 print '</td></tr>';
727
728 $error++;
729 }
730 } else {
731 dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." failed", LOG_ERR);
732 print "<tr><td>";
733 print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
734 print $dolibarr_main_db_host;
735 print '</td><td>';
736 print '<img src="../theme/eldy/img/error.png" alt="Error">';
737 print "</td></tr>";
738
739 // warning message
740 print '<tr><td colspan="2"><br>';
741 print $langs->trans("ErrorConnection", $conf->db->host, $conf->db->name, $conf->db->user);
742 print $langs->trans('IfLoginDoesNotExistsCheckCreateUser').'<br>';
743 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
744 print '</td></tr>';
745
746 $error++;
747 }
748 }
749 }
750
751 print '</table>';
752}
753
754?>
755
756<script type="text/javascript">
757function jsinfo()
758{
759 ok=true;
760
761 //alert('<?php echo dol_escape_js($langs->transnoentities("NextStepMightLastALongTime")); ?>');
762
763 document.getElementById('nextbutton').style.visibility="hidden";
764 document.getElementById('pleasewait').style.visibility="visible";
765
766 return ok;
767}
768</script>
769
770<?php
771
772$ret = 0;
773if ($error && isset($argv[1])) {
774 $ret = 1;
775}
776dolibarr_install_syslog("Exit ".$ret);
777
778dolibarr_install_syslog("--- step1: end");
779
780pFooter($error ? 1 : 0, $setuplang, 'jsinfo', 1);
781
782// Return code if ran from command line
783if ($ret) {
784 exit($ret);
785}
786
787
795function write_main_file($mainfile, $main_dir)
796{
797 $fp = @fopen("$mainfile", "w");
798 if ($fp) {
799 clearstatcache();
800 fputs($fp, '<?php'."\n");
801 fputs($fp, "// Wrapper to include main into htdocs\n");
802 fputs($fp, "include_once '".$main_dir."/main.inc.php';\n");
803 fclose($fp);
804 }
805}
806
807
815function write_master_file($masterfile, $main_dir)
816{
817 $fp = @fopen("$masterfile", "w");
818 if ($fp) {
819 clearstatcache();
820 fputs($fp, '<?php'."\n");
821 fputs($fp, "// Wrapper to include master into htdocs\n");
822 fputs($fp, "include_once '".$main_dir."/master.inc.php';\n");
823 fclose($fp);
824 }
825}
826
827
834function write_conf_file($conffile)
835{
836 global $conf, $langs;
837 global $main_url, $main_dir, $main_data_dir, $main_force_https, $main_use_alt_dir, $main_alt_dir_name, $main_db_prefix;
838 global $dolibarr_main_url_root, $dolibarr_main_document_root, $dolibarr_main_data_root, $dolibarr_main_db_host;
839 global $dolibarr_main_db_port, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
840 global $dolibarr_main_db_type, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_authentication;
841 global $dolibarr_main_distrib;
842 global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation;
843 global $conffile, $conffiletoshow, $conffiletoshowshort;
844 global $force_dolibarr_lib_NUSOAP_PATH;
845 global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH;
846 global $force_dolibarr_lib_GEOIP_PATH;
847 global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP;
848 global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI;
849 global $force_dolibarr_font_DOL_DEFAULT_TTF, $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD;
850
851 $error = 0;
852
853 $key = md5(uniqid(mt_rand(), true)); // Generate random hash
854
855 $fp = fopen("$conffile", "w");
856 if ($fp) {
857 clearstatcache();
858
859 fputs($fp, '<?php'."\n");
860 fputs($fp, '//'."\n");
861 fputs($fp, '// File generated by Dolibarr installer '.DOL_VERSION.' on '.dol_print_date(dol_now(), '')."\n");
862 fputs($fp, '//'."\n");
863 fputs($fp, '// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.' file'."\n");
864 fputs($fp, '// and explanations for all possibles parameters.'."\n");
865 fputs($fp, '//'."\n");
866
867 fputs($fp, '$dolibarr_main_url_root=\''.str_replace("'", "\'", trim($main_url)).'\';');
868 fputs($fp, "\n");
869
870 fputs($fp, '$dolibarr_main_document_root=\''.str_replace("'", "\'", trim($main_dir)).'\';');
871 fputs($fp, "\n");
872
873 fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\''.str_replace("'", "\'", trim("/".$main_alt_dir_name)).'\';');
874 fputs($fp, "\n");
875
876 fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\''.str_replace("'", "\'", trim($main_dir."/".$main_alt_dir_name)).'\';');
877 fputs($fp, "\n");
878
879 fputs($fp, '$dolibarr_main_data_root=\''.str_replace("'", "\'", trim($main_data_dir)).'\';');
880 fputs($fp, "\n");
881
882 fputs($fp, '$dolibarr_main_db_host=\''.str_replace("'", "\'", trim($db_host)).'\';');
883 fputs($fp, "\n");
884
885 fputs($fp, '$dolibarr_main_db_port=\''.str_replace("'", "\'", trim($db_port)).'\';');
886 fputs($fp, "\n");
887
888 fputs($fp, '$dolibarr_main_db_name=\''.str_replace("'", "\'", trim($db_name)).'\';');
889 fputs($fp, "\n");
890
891 fputs($fp, '$dolibarr_main_db_prefix=\''.str_replace("'", "\'", trim($main_db_prefix)).'\';');
892 fputs($fp, "\n");
893
894 fputs($fp, '$dolibarr_main_db_user=\''.str_replace("'", "\'", trim($db_user)).'\';');
895 fputs($fp, "\n");
896 fputs($fp, '$dolibarr_main_db_pass=\''.str_replace("'", "\'", trim($db_pass)).'\';');
897 fputs($fp, "\n");
898
899 fputs($fp, '$dolibarr_main_db_type=\''.str_replace("'", "\'", trim($db_type)).'\';');
900 fputs($fp, "\n");
901
902 fputs($fp, '$dolibarr_main_db_character_set=\''.str_replace("'", "\'", trim($db_character_set)).'\';');
903 fputs($fp, "\n");
904
905 fputs($fp, '$dolibarr_main_db_collation=\''.str_replace("'", "\'", trim($db_collation)).'\';');
906 fputs($fp, "\n");
907
908 // Authentication
909 fputs($fp, '// Authentication settings');
910 fputs($fp, "\n");
911
912 fputs($fp, '$dolibarr_main_authentication=\'dolibarr\';');
913 fputs($fp, "\n\n");
914
915 fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';');
916 fputs($fp, "\n");
917
918 fputs($fp, '// Security settings');
919 fputs($fp, "\n");
920
921 fputs($fp, '$dolibarr_main_prod=\'0\';');
922 fputs($fp, "\n");
923
924 fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';');
925 fputs($fp, "\n");
926
927 fputs($fp, '$dolibarr_main_restrict_os_commands=\'mariadb-dump, mariadb, mysqldump, mysql, pg_dump, pgrestore, clamdscan, clamscan.exe\';');
928 fputs($fp, "\n");
929
930 fputs($fp, '$dolibarr_nocsrfcheck=\'0\';');
931 fputs($fp, "\n");
932
933 fputs($fp, '$dolibarr_main_instance_unique_id=\''.$key.'\';');
934 fputs($fp, "\n");
935
936 fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');
937 fputs($fp, "\n");
938 fputs($fp, '$dolibarr_mailing_limit_sendbycli=\'0\';');
939 fputs($fp, "\n");
940
941 // Write params to overwrites default lib path
942 fputs($fp, "\n");
943 if (empty($force_dolibarr_lib_FPDF_PATH)) {
944 fputs($fp, '//');
945 $force_dolibarr_lib_FPDF_PATH = '';
946 }
947 fputs($fp, '$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.'\';');
948 fputs($fp, "\n");
949 if (empty($force_dolibarr_lib_TCPDF_PATH)) {
950 fputs($fp, '//');
951 $force_dolibarr_lib_TCPDF_PATH = '';
952 }
953 fputs($fp, '$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.'\';');
954 fputs($fp, "\n");
955 if (empty($force_dolibarr_lib_FPDI_PATH)) {
956 fputs($fp, '//');
957 $force_dolibarr_lib_FPDI_PATH = '';
958 }
959 fputs($fp, '$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.'\';');
960 fputs($fp, "\n");
961 if (empty($force_dolibarr_lib_TCPDI_PATH)) {
962 fputs($fp, '//');
963 $force_dolibarr_lib_TCPDI_PATH = '';
964 }
965 fputs($fp, '$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.'\';');
966 fputs($fp, "\n");
967 if (empty($force_dolibarr_lib_GEOIP_PATH)) {
968 fputs($fp, '//');
969 $force_dolibarr_lib_GEOIP_PATH = '';
970 }
971 fputs($fp, '$dolibarr_lib_GEOIP_PATH=\''.$force_dolibarr_lib_GEOIP_PATH.'\';');
972 fputs($fp, "\n");
973 if (empty($force_dolibarr_lib_NUSOAP_PATH)) {
974 fputs($fp, '//');
975 $force_dolibarr_lib_NUSOAP_PATH = '';
976 }
977 fputs($fp, '$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.'\';');
978 fputs($fp, "\n");
979 if (empty($force_dolibarr_lib_ODTPHP_PATH)) {
980 fputs($fp, '//');
981 $force_dolibarr_lib_ODTPHP_PATH = '';
982 }
983 fputs($fp, '$dolibarr_lib_ODTPHP_PATH=\''.$force_dolibarr_lib_ODTPHP_PATH.'\';');
984 fputs($fp, "\n");
985 if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) {
986 fputs($fp, '//');
987 $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = '';
988 }
989 fputs($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.'\';');
990 fputs($fp, "\n");
991 if (empty($force_dolibarr_js_CKEDITOR)) {
992 fputs($fp, '//');
993 $force_dolibarr_js_CKEDITOR = '';
994 }
995 fputs($fp, '$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.'\';');
996 fputs($fp, "\n");
997 if (empty($force_dolibarr_js_JQUERY)) {
998 fputs($fp, '//');
999 $force_dolibarr_js_JQUERY = '';
1000 }
1001 fputs($fp, '$dolibarr_js_JQUERY=\''.$force_dolibarr_js_JQUERY.'\';');
1002 fputs($fp, "\n");
1003 if (empty($force_dolibarr_js_JQUERY_UI)) {
1004 fputs($fp, '//');
1005 $force_dolibarr_js_JQUERY_UI = '';
1006 }
1007 fputs($fp, '$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.'\';');
1008 fputs($fp, "\n");
1009
1010 // Write params to overwrites default font path
1011 fputs($fp, "\n");
1012 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) {
1013 fputs($fp, '//');
1014 $force_dolibarr_font_DOL_DEFAULT_TTF = '';
1015 }
1016 fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\''.$force_dolibarr_font_DOL_DEFAULT_TTF.'\';');
1017 fputs($fp, "\n");
1018 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) {
1019 fputs($fp, '//');
1020 $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = '';
1021 }
1022 fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';');
1023 fputs($fp, "\n");
1024
1025 // Other
1026 fputs($fp, '$dolibarr_main_distrib=\''.str_replace("'", "\'", trim($dolibarr_main_distrib)).'\';');
1027 fputs($fp, "\n");
1028
1029 fclose($fp);
1030
1031 if (file_exists("$conffile")) {
1032 include $conffile; // force config reload, do not put include_once
1033 conf($dolibarr_main_document_root);
1034
1035 print "<tr><td>";
1036 print $langs->trans("SaveConfigurationFile");
1037 print ' <strong>'.$conffile.'</strong>';
1038 print "</td><td>";
1039 print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
1040 print "</td></tr>";
1041 } else {
1042 $error++;
1043 }
1044 }
1045
1046 return $error;
1047}
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1, $testvirus=0, $indexdatabase=0)
Copy a file to another file.
dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists, $arrayreplacement=null, $excludesubdir=0, $excludefileext=null)
Copy a dir to another dir.
dol_is_dir($folder)
Test if filename is a directory.
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).
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.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
conf($dolibarr_main_document_root)
Load conf file (file must exists)
Definition inc.php:403
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition inc.php:516
detect_dolibarr_main_data_root($dolibarr_main_document_root)
Automatically detect Dolibarr's main data root.
Definition inc.php:703
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition inc.php:605
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
Definition inc.php:748
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
Definition inc.php:759
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition inc.php:666
detect_dolibarr_main_url_root()
Automatically detect Dolibarr's main URL root.
Definition inc.php:715
detect_dolibarr_main_document_root()
Automatically detect Dolibarr's main document root.
Definition inc.php:679
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:121
if( $ret) write_main_file($mainfile, $main_dir)
Create main file.
Definition step1.php:795
write_conf_file($conffile)
Save configuration file.
Definition step1.php:834
write_master_file($masterfile, $main_dir)
Create master file.
Definition step1.php:815