Update step2.php

some english translations at  //comments
This commit is contained in:
UT from dolibit 2022-03-12 14:49:54 +01:00 committed by GitHub
parent dc9d8336f5
commit d36d962d36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,8 +34,9 @@ $step = 2;
$ok = 0; $ok = 0;
// Cette page peut etre longue. On augmente le delai autorise. // This page can be long. We increase the time allowed. / Cette page peut etre longue. On augmente le delai autorise.
// Ne fonctionne que si on est pas en safe_mode. // Only works if you are not in safe_mode. / Ne fonctionne que si on est pas en safe_mode.
$err = error_reporting(); $err = error_reporting();
error_reporting(0); // Disable all errors error_reporting(0); // Disable all errors
//error_reporting(E_ALL); //error_reporting(E_ALL);
@ -48,6 +49,9 @@ $langs->setDefaultLang($setuplang);
$langs->loadLangs(array("admin", "install")); $langs->loadLangs(array("admin", "install"));
// Choice of DBMS
$choix = 0; $choix = 0;
if ($dolibarr_main_db_type == "mysqli") { if ($dolibarr_main_db_type == "mysqli") {
$choix = 1; $choix = 1;
@ -64,10 +68,11 @@ if ($dolibarr_main_db_type == "sqlite") {
if ($dolibarr_main_db_type == "sqlite3") { if ($dolibarr_main_db_type == "sqlite3") {
$choix = 5; $choix = 5;
} }
//if (empty($choix)) dol_print_error('','Database type '.$dolibarr_main_db_type.' not supported into step2.php page'); //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. // Now we load forced values from install.forced.php file.
$useforcedwizard = false; $useforcedwizard = false;
$forcedfile = "./install.forced.php"; $forcedfile = "./install.forced.php";
if ($conffile == "/etc/dolibarr/conf.php") { if ($conffile == "/etc/dolibarr/conf.php") {
@ -125,7 +130,7 @@ if ($action == "set") {
} }
// Affiche version // Display version / Affiche version
if ($ok) { if ($ok) {
$version = $db->getVersion(); $version = $db->getVersion();
$versionarray = $db->getVersionArray(); $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 * To do before the files *.key.sql
* *
***************************************************************************************/ ***************************************************************************************/
@ -208,18 +213,18 @@ if ($action == "set") {
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
} }
//print "<tr><td>Creation de la table $name/td>"; //print "<tr><td>Creation of table $name/td>";
$requestnb++; $requestnb++;
dolibarr_install_syslog("step2: request: ".$buffer); dolibarr_install_syslog("step2: request: ".$buffer);
$resql = $db->query($buffer, 0, 'dml'); $resql = $db->query($buffer, 0, 'dml');
if ($resql) { if ($resql) {
// print "<td>OK requete ==== $buffer</td></tr>"; // print "<td>OK request ==== $buffer</td></tr>";
$db->free($resql); $db->free($resql);
} else { } else {
if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' || if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' ||
$db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
//print "<td>Deja existante</td></tr>"; //print "<td>already existing</td></tr>";
} else { } else {
print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name); print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' <br>Executed query : '.$db->lastquery; print "<br>\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.' <br>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 * To do after the files *.sql
* *
***************************************************************************************/ ***************************************************************************************/
@ -279,7 +284,7 @@ if ($action == "set") {
sort($tabledata); sort($tabledata);
foreach ($tabledata as $file) { foreach ($tabledata as $file) {
$name = substr($file, 0, dol_strlen($file) - 4); $name = substr($file, 0, dol_strlen($file) - 4);
//print "<tr><td>Creation de la table $name</td>"; //print "<tr><td>Creation of table $name</td>";
$buffer = ''; $buffer = '';
$fp = fopen($dir.$file, "r"); $fp = fopen($dir.$file, "r");
if ($fp) { if ($fp) {
@ -287,6 +292,7 @@ if ($action == "set") {
$buf = fgets($fp, 4096); $buf = fgets($fp, 4096);
// Special case of lines allowed for some version only // Special case of lines allowed for some version only
// MySQL
if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) { if ($choix == 1 && preg_match('/^--\sV([0-9\.]+)/i', $buf, $reg)) {
$versioncommande = explode('.', $reg[1]); $versioncommande = explode('.', $reg[1]);
//print var_dump($versioncommande); //print var_dump($versioncommande);
@ -298,6 +304,7 @@ if ($action == "set") {
//print "Ligne $i qualifiee par version: ".$buf.'<br>'; //print "Ligne $i qualifiee par version: ".$buf.'<br>';
} }
} }
// PGSQL
if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) { if ($choix == 2 && preg_match('/^--\sPOSTGRESQL\sV([0-9\.]+)/i', $buf, $reg)) {
$versioncommande = explode('.', $reg[1]); $versioncommande = explode('.', $reg[1]);
//print var_dump($versioncommande); //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)) { if (!preg_match('/^--/i', $buf)) {
$buffer .= $buf; $buffer .= $buf;
} }
} }
fclose($fp); fclose($fp);
// Si plusieurs requetes, on boucle sur chaque // If several requests, we loop on each
$listesql = explode(';', $buffer); $listesql = explode(';', $buffer);
foreach ($listesql as $req) { foreach ($listesql as $req) {
$buffer = trim($req); $buffer = trim($req);
@ -327,13 +334,13 @@ if ($action == "set") {
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
} }
//print "<tr><td>Creation des cles et index de la table $name: '$buffer'</td>"; //print "<tr><td>Creation of keys and table index $name: '$buffer'</td>";
$requestnb++; $requestnb++;
dolibarr_install_syslog("step2: request: ".$buffer); dolibarr_install_syslog("step2: request: ".$buffer);
$resql = $db->query($buffer, 0, 'dml'); $resql = $db->query($buffer, 0, 'dml');
if ($resql) { if ($resql) {
//print "<td>OK requete ==== $buffer</td></tr>"; //print "<td>OK request ==== $buffer</td></tr>";
$db->free($resql); $db->free($resql);
} else { } else {
if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || 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) { if ($ok && $createfunctions) {
@ -387,7 +394,7 @@ if ($action == "set") {
$dir = "sqlite3/functions/"; $dir = "sqlite3/functions/";
} }
// Creation donnees // Creation of data
$file = "functions.sql"; $file = "functions.sql";
if (file_exists($dir.$file)) { if (file_exists($dir.$file)) {
$fp = fopen($dir.$file, "r"); $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) { if ($ok && $createdata) {
@ -465,7 +472,7 @@ if ($action == "set") {
while (($file = readdir($handle)) !== false) { while (($file = readdir($handle)) !== false) {
if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\-/', $file)) { if (preg_match('/\.sql$/i', $file) && preg_match('/^llx_/i', $file) && !preg_match('/\-/', $file)) {
if (preg_match('/^llx_accounting_account_/', $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.'<br>'; //print 'x'.$file.'-'.$createdata.'<br>';
@ -520,7 +527,7 @@ if ($action == "set") {
// We loop on each requests of file // We loop on each requests of file
foreach ($arrayofrequests as $buffer) { foreach ($arrayofrequests as $buffer) {
// Replace the prefix tables // Replace the tables prefixes
if ($dolibarr_main_db_prefix != 'llx_') { if ($dolibarr_main_db_prefix != 'llx_') {
$buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer); $buffer = preg_replace('/llx_/i', $dolibarr_main_db_prefix, $buffer);
} }
@ -570,8 +577,10 @@ dolibarr_install_syslog("Exit ".$ret);
dolibarr_install_syslog("- step2: end"); dolibarr_install_syslog("- step2: end");
// Force here a value we need after because master.inc.php is not loaded into step2. // 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 // 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 $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); $hash_unique_id = md5('dolibarr'.$conf->file->instance_unique_id);