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,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 "<tr><td>Creation de la table $name/td>";
//print "<tr><td>Creation of table $name/td>";
$requestnb++;
dolibarr_install_syslog("step2: request: ".$buffer);
$resql = $db->query($buffer, 0, 'dml');
if ($resql) {
// print "<td>OK requete ==== $buffer</td></tr>";
// print "<td>OK request ==== $buffer</td></tr>";
$db->free($resql);
} else {
if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' ||
$db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
//print "<td>Deja existante</td></tr>";
$db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') {
//print "<td>already existing</td></tr>";
} else {
print "<tr><td>".$langs->trans("CreateTableAndPrimaryKey", $name);
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
*
***************************************************************************************/
@ -279,7 +284,7 @@ if ($action == "set") {
sort($tabledata);
foreach ($tabledata as $file) {
$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 = '';
$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.'<br>';
}
}
// 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 "<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++;
dolibarr_install_syslog("step2: request: ".$buffer);
$resql = $db->query($buffer, 0, 'dml');
if ($resql) {
//print "<td>OK requete ==== $buffer</td></tr>";
//print "<td>OK request ==== $buffer</td></tr>";
$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.'<br>';
@ -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);