Skip to content
Snippets Groups Projects
Commit bd5ee3e9 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Try to increase speed with no success.

parent 283692ad
No related branches found
No related tags found
No related merge requests found
...@@ -76,23 +76,24 @@ if ($_POST["action"] == "set") ...@@ -76,23 +76,24 @@ if ($_POST["action"] == "set")
if ($db->connected == 1) if ($db->connected == 1)
{ {
print "<tr><td>"; print "<tr><td>";
print $langs->trans("ServerConnection")." : $dolibarr_main_db_host</td><td>".$langs->trans("OK")."</td></tr>"; print $langs->trans("ServerConnection")." : ".$conf->db->host."</td><td>".$langs->trans("OK")."</td></tr>";
$ok = 1 ; $ok = 1 ;
} }
else else
{ {
print "<tr><td>Erreur lors de la creation de : $dolibarr_main_db_name</td><td>".$langs->trans("Error")."</td></tr>"; print "<tr><td>Failed to connect to server : ".$conf->db->host."</td><td>".$langs->trans("Error")."</td></tr>";
} }
if ($ok) if ($ok)
{ {
if($db->database_selected == 1) if($db->database_selected == 1)
{ {
dolibarr_install_syslog("etape2: Connexion successful to database : ".$conf->db->name);
dolibarr_install_syslog("etape2: Connexion successful to database : $dolibarr_main_db_name");
} }
else else
{ {
dolibarr_install_syslog("etape2: Connexion failed to database : ".$conf->db->name);
print "<tr><td>Failed to select database ".$conf->db->name."</td><td>".$langs->trans("Error")."</td></tr>";
$ok = 0 ; $ok = 0 ;
} }
} }
...@@ -489,17 +490,37 @@ if ($_POST["action"] == "set") ...@@ -489,17 +490,37 @@ if ($_POST["action"] == "set")
dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG); dolibarr_install_syslog("Open data file ".$dir.$file." handle=".$fp,LOG_DEBUG);
if ($fp) if ($fp)
{ {
$arrayofrequests=array();
$linefound=0;
$linegroup=0;
$sizeofgroup=1; // Grouping request to have 1 query for several requests does not works with mysql, so we use 1.
// Load all requests
while (!feof ($fp)) while (!feof ($fp))
{ {
$buffer = fgets($fp, 4096); $buffer = fgets($fp, 4096);
$buffer = trim($buffer); $buffer = trim($buffer);
if ($buffer) if ($buffer)
{ {
if (substr($buffer, 0, 2) == '--') if (substr($buffer, 0, 2) == '--') continue;
if ($linefound && ($linefound % $sizeofgroup) == 0)
{ {
continue; $linegroup++;
}
if (empty($arrayofrequests[$linegroup])) $arrayofrequests[$linegroup]=$buffer;
else $arrayofrequests[$linegroup].=" ".$buffer;
$linefound++;
}
} }
fclose($fp);
dolibarr_install_syslog("Found ".$linefound." records, defined ".sizeof($arrayofrequests)." groups.",LOG_DEBUG);
// We loop on each requests
foreach($arrayofrequests as $buffer)
{
//dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); //dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG);
$resql=$db->query($buffer); $resql=$db->query($buffer);
if ($resql) if ($resql)
...@@ -519,10 +540,7 @@ if ($_POST["action"] == "set") ...@@ -519,10 +540,7 @@ if ($_POST["action"] == "set")
print $langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."<br>"; print $langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."<br>";
} }
} }
}
} }
fclose($fp);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment