dolibarr 18.0.6
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 {
340 $defaultCharacterSet = $db->getDefaultCharacterSetDatabase();
341 $defaultDBSortingCollation = $db->getDefaultCollationDatabase();
342 }
343
344 // 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)
345 // TODO Remove this when utf8mb4 is supported
346 if ($defaultCharacterSet == 'utf8mb4' || $defaultDBSortingCollation == 'utf8mb4_unicode_ci') {
347 $defaultCharacterSet = 'utf8';
348 $defaultDBSortingCollation = 'utf8_unicode_ci';
349 }
350
351 print '<input type="hidden" name="dolibarr_main_db_character_set" value="'.$defaultCharacterSet.'">';
352 print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
353 $db_character_set = $defaultCharacterSet;
354 $db_collation = $defaultDBSortingCollation;
355 dolibarr_install_syslog("step1: db_character_set=".$db_character_set." db_collation=".$db_collation);
356}
357
358
359// Create config file
360if (!$error && $db->connected && $action == "set") {
361 umask(0);
362 if (is_array($_POST)) {
363 foreach ($_POST as $key => $value) {
364 if (!preg_match('/^db_pass/i', $key)) {
365 dolibarr_install_syslog("step1: choice for ".$key." = ".$value);
366 }
367 }
368 }
369
370 // Show title of step
371 print '<h3><img class="valignmiddle inline-block paddingright" src="../theme/common/octicons/build/svg/gear.svg" width="20" alt="Configuration"> '.$langs->trans("ConfigurationFile").'</h3>';
372 print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
373
374 // Check parameter main_dir
375 if (!$error) {
376 if (!is_dir($main_dir)) {
377 dolibarr_install_syslog("step1: directory '".$main_dir."' is unavailable or can't be accessed");
378
379 print "<tr><td>";
380 print $langs->trans("ErrorDirDoesNotExists", $main_dir).'<br>';
381 print $langs->trans("ErrorWrongValueForParameter", $langs->transnoentitiesnoconv("WebPagesDirectory")).'<br>';
382 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
383 print '</td><td>';
384 print $langs->trans("Error");
385 print "</td></tr>";
386 $error++;
387 }
388 }
389
390 if (!$error) {
391 dolibarr_install_syslog("step1: directory '".$main_dir."' exists");
392 }
393
394
395 // Create subdirectory main_data_dir
396 if (!$error) {
397 // Create directory for documents
398 if (!is_dir($main_data_dir)) {
399 dol_mkdir($main_data_dir);
400 }
401
402 if (!is_dir($main_data_dir)) {
403 print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
404 print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
405 print '</td><td>';
406 print '<span class="error">'.$langs->trans("Error").'</span>';
407 print "</td></tr>";
408 print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
409 $error++;
410 } else {
411 // Create .htaccess file in document directory
412 $pathhtaccess = $main_data_dir.'/.htaccess';
413 if (!file_exists($pathhtaccess)) {
414 dolibarr_install_syslog("step1: .htaccess file did not exist, we created it in '".$main_data_dir."'");
415 $handlehtaccess = @fopen($pathhtaccess, 'w');
416 if ($handlehtaccess) {
417 fwrite($handlehtaccess, 'Order allow,deny'."\n");
418 fwrite($handlehtaccess, 'Deny from all'."\n");
419
420 fclose($handlehtaccess);
421 dolibarr_install_syslog("step1: .htaccess file created");
422 }
423 }
424
425 // Documents are stored above the web pages root to prevent being downloaded without authentification
426 $dir = array();
427 $dir[] = $main_data_dir."/mycompany";
428 $dir[] = $main_data_dir."/medias";
429 $dir[] = $main_data_dir."/users";
430 $dir[] = $main_data_dir."/facture";
431 $dir[] = $main_data_dir."/propale";
432 $dir[] = $main_data_dir."/ficheinter";
433 $dir[] = $main_data_dir."/produit";
434 $dir[] = $main_data_dir."/doctemplates";
435
436 // Loop on each directory of dir [] to create them if they do not exist
437 $num = count($dir);
438 for ($i = 0; $i < $num; $i++) {
439 if (is_dir($dir[$i])) {
440 dolibarr_install_syslog("step1: directory '".$dir[$i]."' exists");
441 } else {
442 if (dol_mkdir($dir[$i]) < 0) {
443 print "<tr><td>";
444 print "Failed to create directory: ".$dir[$i];
445 print '</td><td>';
446 print $langs->trans("Error");
447 print "</td></tr>";
448 $error++;
449 } else {
450 dolibarr_install_syslog("step1: directory '".$dir[$i]."' created");
451 }
452 }
453 }
454
455 require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
456
457 // Copy directory medias
458 $srcroot = $main_dir.'/install/medias';
459 $destroot = $main_data_dir.'/medias';
460 dolCopyDir($srcroot, $destroot, 0, 0);
461
462 if ($error) {
463 print "<tr><td>".$langs->trans("ErrorDirDoesNotExists", $main_data_dir);
464 print ' '.$langs->trans("YouMustCreateItAndAllowServerToWrite");
465 print '</td><td>';
466 print '<span class="error">'.$langs->trans("Error").'</span>';
467 print "</td></tr>";
468 print '<tr><td colspan="2"><br>'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').'</td></tr>';
469 } else {
470 //ODT templates
471 $srcroot = $main_dir.'/install/doctemplates';
472 $destroot = $main_data_dir.'/doctemplates';
473 $docs = array(
474 'contracts' => 'contract',
475 'invoices' => 'invoice',
476 'orders' => 'order',
477 'products' => 'product',
478 'projects' => 'project',
479 'proposals' => 'proposal',
480 'shipments' => 'shipment',
481 'supplier_proposals' => 'supplier_proposal',
482 'tasks' => 'task_summary',
483 'thirdparties' => 'thirdparty',
484 'usergroups' => 'usergroups',
485 'users' => 'user',
486 );
487 foreach ($docs as $cursordir => $cursorfile) {
488 $src = $srcroot.'/'.$cursordir.'/template_'.$cursorfile.'.odt';
489 $dirodt = $destroot.'/'.$cursordir;
490 $dest = $dirodt.'/template_'.$cursorfile.'.odt';
491
492 dol_mkdir($dirodt);
493 $result = dol_copy($src, $dest, 0, 0);
494 if ($result < 0) {
495 print '<tr><td colspan="2"><br>'.$langs->trans('ErrorFailToCopyFile', $src, $dest).'</td></tr>';
496 }
497 }
498 }
499 }
500 }
501
502 // Table prefix
503 $main_db_prefix = (!empty($db_prefix) ? $db_prefix : 'llx_');
504
505 // Write conf file on disk
506 if (!$error) {
507 // Save old conf file on disk
508 if (file_exists("$conffile")) {
509 // We must ignore errors as an existing old file may already exist and not be replaceable or
510 // the installer (like for ubuntu) may not have permission to create another file than conf.php.
511 // Also no other process must be able to read file or we expose the new file, so content with password.
512 @dol_copy($conffile, $conffile.'.old', '0400');
513 }
514
515 $error += write_conf_file($conffile);
516 }
517
518 // Create database and admin user database
519 if (!$error) {
520 // We reload configuration file
521 conf($dolibarr_main_document_root);
522
523 print '<tr><td>';
524 print $langs->trans("ConfFileReload");
525 print '</td>';
526 print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
527
528 // Create database user if requested
529 if (isset($db_create_user) && ($db_create_user == "1" || $db_create_user == "on")) {
530 dolibarr_install_syslog("step1: create database user: ".$dolibarr_main_db_user);
531
532 //print $conf->db->host." , ".$conf->db->name." , ".$conf->db->user." , ".$conf->db->port;
533 $databasefortest = $conf->db->name;
534 if ($conf->db->type == 'mysql' || $conf->db->type == 'mysqli') {
535 $databasefortest = 'mysql';
536 } elseif ($conf->db->type == 'pgsql') {
537 $databasefortest = 'postgres';
538 } elseif ($conf->db->type == 'mssql') {
539 $databasefortest = 'master';
540 }
541
542 // Check database connection
543
544 $db = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, $databasefortest, (int) $conf->db->port);
545
546 if ($db->error) {
547 print '<div class="error">'.$db->error.'</div>';
548 $error++;
549 }
550
551 if (!$error) {
552 if ($db->connected) {
553 $resultbis = 1;
554
555 if (empty($dolibarr_main_db_pass)) {
556 dolibarr_install_syslog("step1: failed to create user, password is empty", LOG_ERR);
557 print '<tr><td>';
558 print $langs->trans("UserCreation").' : ';
559 print $dolibarr_main_db_user;
560 print '</td>';
561 print '<td>'.$langs->trans("Error").": A password for database user is mandatory.</td></tr>";
562 } else {
563 // Create user
564 $result = $db->DDLCreateUser($dolibarr_main_db_host, $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
565
566 // Create user bis
567 if ($databasefortest == 'mysql') {
568 if (!in_array($dolibarr_main_db_host, array('127.0.0.1', '::1', 'localhost', 'localhost.local'))) {
569 $resultbis = $db->DDLCreateUser('%', $dolibarr_main_db_user, $dolibarr_main_db_pass, $dolibarr_main_db_name);
570 }
571 }
572
573 if ($result > 0 && $resultbis > 0) {
574 print '<tr><td>';
575 print $langs->trans("UserCreation").' : ';
576 print $dolibarr_main_db_user;
577 print '</td>';
578 print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
579 } else {
580 if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS'
581 || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS'
582 || $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS') {
583 dolibarr_install_syslog("step1: user already exists");
584 print '<tr><td>';
585 print $langs->trans("UserCreation").' : ';
586 print $dolibarr_main_db_user;
587 print '</td>';
588 print '<td>'.$langs->trans("LoginAlreadyExists").'</td></tr>';
589 } else {
590 dolibarr_install_syslog("step1: failed to create user", LOG_ERR);
591 print '<tr><td>';
592 print $langs->trans("UserCreation").' : ';
593 print $dolibarr_main_db_user;
594 print '</td>';
595 print '<td>'.$langs->trans("Error").': '.$db->errno().' '.$db->error().($db->error ? '. '.$db->error : '')."</td></tr>";
596 }
597 }
598 }
599
600 $db->close();
601 } else {
602 print '<tr><td>';
603 print $langs->trans("UserCreation").' : ';
604 print $dolibarr_main_db_user;
605 print '</td>';
606 print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
607 print '</tr>';
608
609 // warning message due to connection failure
610 print '<tr><td colspan="2"><br>';
611 print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
612 print '<br>';
613 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
614 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
615 print '</td></tr>';
616
617 $error++;
618 }
619 }
620 } // end of user account creation
621
622
623 // If database creation was asked, we create it
624 if (!$error && (isset($db_create_database) && ($db_create_database == "1" || $db_create_database == "on"))) {
625 dolibarr_install_syslog("step1: create database: ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user);
626 $newdb = getDoliDBInstance($conf->db->type, $conf->db->host, $userroot, $passroot, '', (int) $conf->db->port);
627 //print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
628
629 if ($newdb->connected) {
630 $result = $newdb->DDLCreateDb($dolibarr_main_db_name, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_db_user);
631
632 if ($result) {
633 print '<tr><td>';
634 print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
635 print $dolibarr_main_db_name;
636 print '</td>';
637 print '<td><img src="../theme/eldy/img/tick.png" alt="Ok"></td></tr>';
638
639 $newdb->select_db($dolibarr_main_db_name);
640 $check1 = $newdb->getDefaultCharacterSetDatabase();
641 $check2 = $newdb->getDefaultCollationDatabase();
642 dolibarr_install_syslog('step1: new database is using charset='.$check1.' collation='.$check2);
643
644 // If values differs, we save conf file again
645 //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);
646 //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING);
647 } else {
648 // warning message
649 print '<tr><td colspan="2"><br>';
650 print $langs->trans("ErrorFailedToCreateDatabase", $dolibarr_main_db_name).'<br>';
651 print $newdb->lasterror().'<br>';
652 print $langs->trans("IfDatabaseExistsGoBackAndCheckCreate");
653 print '<br>';
654 print '</td></tr>';
655
656 dolibarr_install_syslog('step1: failed to create database '.$dolibarr_main_db_name.' '.$newdb->lasterrno().' '.$newdb->lasterror(), LOG_ERR);
657 $error++;
658 }
659 $newdb->close();
660 } else {
661 print '<tr><td>';
662 print $langs->trans("DatabaseCreation")." (".$langs->trans("User")." ".$userroot.") : ";
663 print $dolibarr_main_db_name;
664 print '</td>';
665 print '<td><img src="../theme/eldy/img/error.png" alt="Error"></td>';
666 print '</tr>';
667
668 // warning message
669 print '<tr><td colspan="2"><br>';
670 print $langs->trans("YouAskDatabaseCreationSoDolibarrNeedToConnect", $dolibarr_main_db_user, $dolibarr_main_db_host, $userroot);
671 print '<br>';
672 print $langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
673 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
674 print '</td></tr>';
675
676 $error++;
677 }
678 } // end of create database
679
680
681 // We test access with dolibarr database user (not admin)
682 if (!$error) {
683 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);
684 //print "connexion de type=".$conf->db->type." sur host=".$conf->db->host." port=".$conf->db->port." user=".$conf->db->user." name=".$conf->db->name;
685
686 $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, (int) $conf->db->port);
687
688 if ($db->connected) {
689 dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." ok");
690 print "<tr><td>";
691 print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
692 print $dolibarr_main_db_host;
693 print "</td><td>";
694 print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
695 print "</td></tr>";
696
697 // server access ok, basic access ok
698 if ($db->database_selected) {
699 dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." ok");
700 print "<tr><td>";
701 print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
702 print $dolibarr_main_db_name;
703 print "</td><td>";
704 print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
705 print "</td></tr>";
706
707 $error = 0;
708 } else {
709 dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." failed", LOG_ERR);
710 print "<tr><td>";
711 print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
712 print $dolibarr_main_db_name;
713 print '</td><td>';
714 print '<img src="../theme/eldy/img/error.png" alt="Error">';
715 print "</td></tr>";
716
717 // warning message
718 print '<tr><td colspan="2"><br>';
719 print $langs->trans('CheckThatDatabasenameIsCorrect', $dolibarr_main_db_name).'<br>';
720 print $langs->trans('IfAlreadyExistsCheckOption').'<br>';
721 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
722 print '</td></tr>';
723
724 $error++;
725 }
726 } else {
727 dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." failed", LOG_ERR);
728 print "<tr><td>";
729 print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : ";
730 print $dolibarr_main_db_host;
731 print '</td><td>';
732 print '<img src="../theme/eldy/img/error.png" alt="Error">';
733 print "</td></tr>";
734
735 // warning message
736 print '<tr><td colspan="2"><br>';
737 print $langs->trans("ErrorConnection", $conf->db->host, $conf->db->name, $conf->db->user);
738 print $langs->trans('IfLoginDoesNotExistsCheckCreateUser').'<br>';
739 print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
740 print '</td></tr>';
741
742 $error++;
743 }
744 }
745 }
746
747 print '</table>';
748}
749
750?>
751
752<script type="text/javascript">
753function jsinfo()
754{
755 ok=true;
756
757 //alert('<?php echo dol_escape_js($langs->transnoentities("NextStepMightLastALongTime")); ?>');
758
759 document.getElementById('nextbutton').style.visibility="hidden";
760 document.getElementById('pleasewait').style.visibility="visible";
761
762 return ok;
763}
764</script>
765
766<?php
767
768$ret = 0;
769if ($error && isset($argv[1])) {
770 $ret = 1;
771}
772dolibarr_install_syslog("Exit ".$ret);
773
774dolibarr_install_syslog("--- step1: end");
775
776pFooter($error ? 1 : 0, $setuplang, 'jsinfo', 1);
777
778// Return code if ran from command line
779if ($ret) {
780 exit($ret);
781}
782
783
791function write_main_file($mainfile, $main_dir)
792{
793 $fp = @fopen("$mainfile", "w");
794 if ($fp) {
795 clearstatcache();
796 fputs($fp, '<?php'."\n");
797 fputs($fp, "// Wrapper to include main into htdocs\n");
798 fputs($fp, "include_once '".$main_dir."/main.inc.php';\n");
799 fclose($fp);
800 }
801}
802
803
811function write_master_file($masterfile, $main_dir)
812{
813 $fp = @fopen("$masterfile", "w");
814 if ($fp) {
815 clearstatcache();
816 fputs($fp, '<?php'."\n");
817 fputs($fp, "// Wrapper to include master into htdocs\n");
818 fputs($fp, "include_once '".$main_dir."/master.inc.php';\n");
819 fclose($fp);
820 }
821}
822
823
830function write_conf_file($conffile)
831{
832 global $conf, $langs;
833 global $main_url, $main_dir, $main_data_dir, $main_force_https, $main_use_alt_dir, $main_alt_dir_name, $main_db_prefix;
834 global $dolibarr_main_url_root, $dolibarr_main_document_root, $dolibarr_main_data_root, $dolibarr_main_db_host;
835 global $dolibarr_main_db_port, $dolibarr_main_db_name, $dolibarr_main_db_user, $dolibarr_main_db_pass;
836 global $dolibarr_main_db_type, $dolibarr_main_db_character_set, $dolibarr_main_db_collation, $dolibarr_main_authentication;
837 global $dolibarr_main_distrib;
838 global $db_host, $db_port, $db_name, $db_user, $db_pass, $db_type, $db_character_set, $db_collation;
839 global $conffile, $conffiletoshow, $conffiletoshowshort;
840 global $force_dolibarr_lib_NUSOAP_PATH;
841 global $force_dolibarr_lib_TCPDF_PATH, $force_dolibarr_lib_FPDI_PATH;
842 global $force_dolibarr_lib_GEOIP_PATH;
843 global $force_dolibarr_lib_ODTPHP_PATH, $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP;
844 global $force_dolibarr_js_CKEDITOR, $force_dolibarr_js_JQUERY, $force_dolibarr_js_JQUERY_UI;
845 global $force_dolibarr_font_DOL_DEFAULT_TTF, $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD;
846
847 $error = 0;
848
849 $key = md5(uniqid(mt_rand(), true)); // Generate random hash
850
851 $fp = fopen("$conffile", "w");
852 if ($fp) {
853 clearstatcache();
854
855 fputs($fp, '<?php'."\n");
856 fputs($fp, '//'."\n");
857 fputs($fp, '// File generated by Dolibarr installer '.DOL_VERSION.' on '.dol_print_date(dol_now(), '')."\n");
858 fputs($fp, '//'."\n");
859 fputs($fp, '// Take a look at conf.php.example file for an example of '.$conffiletoshowshort.' file'."\n");
860 fputs($fp, '// and explanations for all possibles parameters.'."\n");
861 fputs($fp, '//'."\n");
862
863 fputs($fp, '$dolibarr_main_url_root=\''.str_replace("'", "\'", trim($main_url)).'\';');
864 fputs($fp, "\n");
865
866 fputs($fp, '$dolibarr_main_document_root=\''.str_replace("'", "\'", trim($main_dir)).'\';');
867 fputs($fp, "\n");
868
869 fputs($fp, $main_use_alt_dir.'$dolibarr_main_url_root_alt=\''.str_replace("'", "\'", trim("/".$main_alt_dir_name)).'\';');
870 fputs($fp, "\n");
871
872 fputs($fp, $main_use_alt_dir.'$dolibarr_main_document_root_alt=\''.str_replace("'", "\'", trim($main_dir."/".$main_alt_dir_name)).'\';');
873 fputs($fp, "\n");
874
875 fputs($fp, '$dolibarr_main_data_root=\''.str_replace("'", "\'", trim($main_data_dir)).'\';');
876 fputs($fp, "\n");
877
878 fputs($fp, '$dolibarr_main_db_host=\''.str_replace("'", "\'", trim($db_host)).'\';');
879 fputs($fp, "\n");
880
881 fputs($fp, '$dolibarr_main_db_port=\''.str_replace("'", "\'", trim($db_port)).'\';');
882 fputs($fp, "\n");
883
884 fputs($fp, '$dolibarr_main_db_name=\''.str_replace("'", "\'", trim($db_name)).'\';');
885 fputs($fp, "\n");
886
887 fputs($fp, '$dolibarr_main_db_prefix=\''.str_replace("'", "\'", trim($main_db_prefix)).'\';');
888 fputs($fp, "\n");
889
890 fputs($fp, '$dolibarr_main_db_user=\''.str_replace("'", "\'", trim($db_user)).'\';');
891 fputs($fp, "\n");
892 fputs($fp, '$dolibarr_main_db_pass=\''.str_replace("'", "\'", trim($db_pass)).'\';');
893 fputs($fp, "\n");
894
895 fputs($fp, '$dolibarr_main_db_type=\''.str_replace("'", "\'", trim($db_type)).'\';');
896 fputs($fp, "\n");
897
898 fputs($fp, '$dolibarr_main_db_character_set=\''.str_replace("'", "\'", trim($db_character_set)).'\';');
899 fputs($fp, "\n");
900
901 fputs($fp, '$dolibarr_main_db_collation=\''.str_replace("'", "\'", trim($db_collation)).'\';');
902 fputs($fp, "\n");
903
904 // Authentication
905 fputs($fp, '// Authentication settings');
906 fputs($fp, "\n");
907
908 fputs($fp, '$dolibarr_main_authentication=\'dolibarr\';');
909 fputs($fp, "\n\n");
910
911 fputs($fp, '//$dolibarr_main_demo=\'autologin,autopass\';');
912 fputs($fp, "\n");
913
914 fputs($fp, '// Security settings');
915 fputs($fp, "\n");
916
917 fputs($fp, '$dolibarr_main_prod=\'0\';');
918 fputs($fp, "\n");
919
920 fputs($fp, '$dolibarr_main_force_https=\''.$main_force_https.'\';');
921 fputs($fp, "\n");
922
923 fputs($fp, '$dolibarr_main_restrict_os_commands=\'mysqldump, mysql, pg_dump, pgrestore, clamdscan, clamscan.exe\';');
924 fputs($fp, "\n");
925
926 fputs($fp, '$dolibarr_nocsrfcheck=\'0\';');
927 fputs($fp, "\n");
928
929 fputs($fp, '$dolibarr_main_instance_unique_id=\''.$key.'\';');
930 fputs($fp, "\n");
931
932 fputs($fp, '$dolibarr_mailing_limit_sendbyweb=\'0\';');
933 fputs($fp, "\n");
934 fputs($fp, '$dolibarr_mailing_limit_sendbycli=\'0\';');
935 fputs($fp, "\n");
936
937 // Write params to overwrites default lib path
938 fputs($fp, "\n");
939 if (empty($force_dolibarr_lib_FPDF_PATH)) {
940 fputs($fp, '//'); $force_dolibarr_lib_FPDF_PATH = '';
941 }
942 fputs($fp, '$dolibarr_lib_FPDF_PATH=\''.$force_dolibarr_lib_FPDF_PATH.'\';');
943 fputs($fp, "\n");
944 if (empty($force_dolibarr_lib_TCPDF_PATH)) {
945 fputs($fp, '//'); $force_dolibarr_lib_TCPDF_PATH = '';
946 }
947 fputs($fp, '$dolibarr_lib_TCPDF_PATH=\''.$force_dolibarr_lib_TCPDF_PATH.'\';');
948 fputs($fp, "\n");
949 if (empty($force_dolibarr_lib_FPDI_PATH)) {
950 fputs($fp, '//'); $force_dolibarr_lib_FPDI_PATH = '';
951 }
952 fputs($fp, '$dolibarr_lib_FPDI_PATH=\''.$force_dolibarr_lib_FPDI_PATH.'\';');
953 fputs($fp, "\n");
954 if (empty($force_dolibarr_lib_TCPDI_PATH)) {
955 fputs($fp, '//'); $force_dolibarr_lib_TCPDI_PATH = '';
956 }
957 fputs($fp, '$dolibarr_lib_TCPDI_PATH=\''.$force_dolibarr_lib_TCPDI_PATH.'\';');
958 fputs($fp, "\n");
959 if (empty($force_dolibarr_lib_GEOIP_PATH)) {
960 fputs($fp, '//'); $force_dolibarr_lib_GEOIP_PATH = '';
961 }
962 fputs($fp, '$dolibarr_lib_GEOIP_PATH=\''.$force_dolibarr_lib_GEOIP_PATH.'\';');
963 fputs($fp, "\n");
964 if (empty($force_dolibarr_lib_NUSOAP_PATH)) {
965 fputs($fp, '//'); $force_dolibarr_lib_NUSOAP_PATH = '';
966 }
967 fputs($fp, '$dolibarr_lib_NUSOAP_PATH=\''.$force_dolibarr_lib_NUSOAP_PATH.'\';');
968 fputs($fp, "\n");
969 if (empty($force_dolibarr_lib_ODTPHP_PATH)) {
970 fputs($fp, '//'); $force_dolibarr_lib_ODTPHP_PATH = '';
971 }
972 fputs($fp, '$dolibarr_lib_ODTPHP_PATH=\''.$force_dolibarr_lib_ODTPHP_PATH.'\';');
973 fputs($fp, "\n");
974 if (empty($force_dolibarr_lib_ODTPHP_PATHTOPCLZIP)) {
975 fputs($fp, '//'); $force_dolibarr_lib_ODTPHP_PATHTOPCLZIP = '';
976 }
977 fputs($fp, '$dolibarr_lib_ODTPHP_PATHTOPCLZIP=\''.$force_dolibarr_lib_ODTPHP_PATHTOPCLZIP.'\';');
978 fputs($fp, "\n");
979 if (empty($force_dolibarr_js_CKEDITOR)) {
980 fputs($fp, '//'); $force_dolibarr_js_CKEDITOR = '';
981 }
982 fputs($fp, '$dolibarr_js_CKEDITOR=\''.$force_dolibarr_js_CKEDITOR.'\';');
983 fputs($fp, "\n");
984 if (empty($force_dolibarr_js_JQUERY)) {
985 fputs($fp, '//'); $force_dolibarr_js_JQUERY = '';
986 }
987 fputs($fp, '$dolibarr_js_JQUERY=\''.$force_dolibarr_js_JQUERY.'\';');
988 fputs($fp, "\n");
989 if (empty($force_dolibarr_js_JQUERY_UI)) {
990 fputs($fp, '//'); $force_dolibarr_js_JQUERY_UI = '';
991 }
992 fputs($fp, '$dolibarr_js_JQUERY_UI=\''.$force_dolibarr_js_JQUERY_UI.'\';');
993 fputs($fp, "\n");
994
995 // Write params to overwrites default font path
996 fputs($fp, "\n");
997 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF)) {
998 fputs($fp, '//'); $force_dolibarr_font_DOL_DEFAULT_TTF = '';
999 }
1000 fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF=\''.$force_dolibarr_font_DOL_DEFAULT_TTF.'\';');
1001 fputs($fp, "\n");
1002 if (empty($force_dolibarr_font_DOL_DEFAULT_TTF_BOLD)) {
1003 fputs($fp, '//'); $force_dolibarr_font_DOL_DEFAULT_TTF_BOLD = '';
1004 }
1005 fputs($fp, '$dolibarr_font_DOL_DEFAULT_TTF_BOLD=\''.$force_dolibarr_font_DOL_DEFAULT_TTF_BOLD.'\';');
1006 fputs($fp, "\n");
1007
1008 // Other
1009 fputs($fp, '$dolibarr_main_distrib=\''.str_replace("'", "\'", trim($dolibarr_main_distrib)).'\';');
1010 fputs($fp, "\n");
1011
1012 fclose($fp);
1013
1014 if (file_exists("$conffile")) {
1015 include $conffile; // force config reload, do not put include_once
1016 conf($dolibarr_main_document_root);
1017
1018 print "<tr><td>";
1019 print $langs->trans("SaveConfigurationFile");
1020 print ' <strong>'.$conffile.'</strong>';
1021 print "</td><td>";
1022 print '<img src="../theme/eldy/img/tick.png" alt="Ok">';
1023 print "</td></tr>";
1024 } else {
1025 $error++;
1026 }
1027 }
1028
1029 return $error;
1030}
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:400
pHeader($subtitle, $next, $action='set', $param='', $forcejqueryurl='', $csstable='main-inside')
Show HTML header of install pages.
Definition inc.php:513
detect_dolibarr_main_data_root($dolibarr_main_document_root)
Automatically detect Dolibarr's main data root.
Definition inc.php:700
pFooter($nonext=0, $setuplang='', $jscheckfunction='', $withpleasewait=0, $morehtml='')
Print HTML footer of install pages.
Definition inc.php:602
parse_database_login($force_install_databaserootlogin)
Replaces automatic database login by actual value.
Definition inc.php:745
parse_database_pass($force_install_databaserootpass)
Replaces automatic database password by actual value.
Definition inc.php:756
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Definition inc.php:663
detect_dolibarr_main_url_root()
Automatically detect Dolibarr's main URL root.
Definition inc.php:712
detect_dolibarr_main_document_root()
Automatically detect Dolibarr's main document root.
Definition inc.php:676
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
Definition repair.php:120
if( $ret) write_main_file($mainfile, $main_dir)
Create main file.
Definition step1.php:791
write_conf_file($conffile)
Save configuration file.
Definition step1.php:830
write_master_file($masterfile, $main_dir)
Create master file.
Definition step1.php:811