diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php
index 45b7d742f3e..06fb7949397 100644
--- a/htdocs/install/step2.php
+++ b/htdocs/install/step2.php
@@ -34,12 +34,13 @@ $step = 2;
$ok = 0;
-// Cette page peut etre longue. On augmente le delai autorise.
-// Ne fonctionne que si on est pas en safe_mode.
+// This page can be long. We increase the time allowed. / Cette page peut etre longue. On augmente le delai autorise.
+// Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode.
+
$err = error_reporting();
-error_reporting(0); // Disable all errors
+error_reporting(0); // Disable all errors
//error_reporting(E_ALL);
-@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64
+@set_time_limit(1800); // Need 1800 on some very slow OS like Windows 7/64
error_reporting($err);
$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : (empty($argv[1]) ? '' : $argv[1]);
@@ -48,6 +49,9 @@ $langs->setDefaultLang($setuplang);
$langs->loadLangs(array("admin", "install"));
+
+// Choice of DBMS
+
$choix = 0;
if ($dolibarr_main_db_type == "mysqli") {
$choix = 1;
@@ -64,10 +68,11 @@ if ($dolibarr_main_db_type == "sqlite") {
if ($dolibarr_main_db_type == "sqlite3") {
$choix = 5;
}
-
//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page');
+
// Now we load forced values from install.forced.php file.
+
$useforcedwizard = false;
$forcedfile = "./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") {
@@ -124,8 +129,8 @@ if ($action == "set") {
}
}
-
- // Affiche version
+
+ // Display version / Affiche version
if ($ok) {
$version = $db->getVersion();
$versionarray = $db->getVersionArray();
@@ -154,7 +159,7 @@ if ($action == "set") {
/**************************************************************************************
*
- * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx').
+ * Load files tables/*.sql (not the *.key.sql). Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx').
* To do before the files *.key.sql
*
***************************************************************************************/
@@ -208,18 +213,18 @@ if ($action == "set") {
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
}
- //print "
| Creation de la table $name/td>";
+ //print " |
| Creation of table $name/td>";
$requestnb++;
dolibarr_install_syslog("step2: request: ".$buffer);
$resql = $db->query($buffer, 0, 'dml');
if ($resql) {
- // print " | OK requete ==== $buffer |
";
+ // print "OK request ==== $buffer | ";
$db->free($resql);
} else {
if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' ||
- $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
- //print "Deja existante | ";
+ $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
+ //print "already existing | ";
} else {
print "".$langs->trans("CreateTableAndPrimaryKey", $name);
print " \n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' Executed query : '.$db->lastquery;
@@ -252,7 +257,7 @@ if ($action == "set") {
/***************************************************************************************
*
- * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx').
+ * Load files tables/*.key.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx').
* To do after the files *.sql
*
***************************************************************************************/
@@ -279,7 +284,7 @@ if ($action == "set") {
sort($tabledata);
foreach ($tabledata as $file) {
$name = substr($file, 0, dol_strlen($file) - 4);
- //print " |
| Creation de la table $name | ";
+ //print "
| Creation of table $name | ";
$buffer = '';
$fp = fopen($dir.$file, "r");
if ($fp) {
@@ -287,6 +292,7 @@ if ($action == "set") {
$buf = fgets($fp, 4096);
// Special case of lines allowed for some version only
+ // MySQL
if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) {
$versioncommande = explode('.', $reg[1]);
//print var_dump($versioncommande);
@@ -298,6 +304,7 @@ if ($action == "set") {
//print "Ligne $i qualifiee par version: ".$buf.'
';
}
}
+ // PGSQL
if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) {
$versioncommande = explode('.', $reg[1]);
//print var_dump($versioncommande);
@@ -310,14 +317,14 @@ if ($action == "set") {
}
}
- // Ajout ligne si non commentaire
+ // Add line if no comment
if (!preg_match('/^--/i', $buf)) {
$buffer .= $buf;
}
}
fclose($fp);
- // Si plusieurs requetes, on boucle sur chaque
+ // If several requests, we loop on each
$listesql = explode(';', $buffer);
foreach ($listesql as $req) {
$buffer = trim($req);
@@ -327,13 +334,13 @@ if ($action == "set") {
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
}
- //print "
| Creation des cles et index de la table $name: '$buffer' | ";
+ //print "
| Creation of keys and table index $name: '$buffer' | ";
$requestnb++;
dolibarr_install_syslog("step2: request: ".$buffer);
$resql = $db->query($buffer, 0, 'dml');
if ($resql) {
- //print "OK requete ==== $buffer |
";
+ //print "OK request ==== $buffer | ";
$db->free($resql);
} else {
if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' ||
@@ -372,7 +379,7 @@ if ($action == "set") {
/***************************************************************************************
*
- * Lod the file 'functions.sql'
+ * Load the file 'functions.sql'
*
***************************************************************************************/
if ($ok && $createfunctions) {
@@ -387,7 +394,7 @@ if ($action == "set") {
$dir = "sqlite3/functions/";
}
- // Creation donnees
+ // Creation of data
$file = "functions.sql";
if (file_exists($dir.$file)) {
$fp = fopen($dir.$file, "r");
@@ -449,7 +456,7 @@ if ($action == "set") {
/***************************************************************************************
*
- * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation o fmodule 'xxx').
+ * Load files data/*.sql. Files with '-xxx' in name are excluded (they will be loaded during activation of module 'xxx').
*
***************************************************************************************/
if ($ok && $createdata) {
@@ -465,7 +472,7 @@ if ($action == "set") {
while (($file = readdir($handle)) !== false) {
if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\-/', $file)) {
if (preg_match('/^llx_accounting_account_/', $file)) {
- continue; // We discard data file of chart of account. Will be loaded when a chart is selected.
+ continue; // We discard data file of chart of account. This will be loaded when a chart is selected.
}
//print 'x'.$file.'-'.$createdata.'
';
@@ -520,7 +527,7 @@ if ($action == "set") {
// We loop on each requests of file
foreach ($arrayofrequests as $buffer) {
- // Replace the prefix tables
+ // Replace the tables prefixes
if ($dolibarr_main_db_prefix != 'llx_') {
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
}
@@ -570,8 +577,10 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end");
+
// Force here a value we need after because master.inc.php is not loaded into step2.
// This code must be similar with the one into main.inc.php
+
$conf->file->instance_unique_id = (empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id); // Unique id of instance
$hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);