From e40d8991b1217ae5e74354b3dd9f489c964053d2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jan 2012 13:14:29 +0100 Subject: [PATCH] Install process is 10 times faster in step2 ! --- htdocs/install/default.css | 6 ++++-- htdocs/install/etape2.php | 34 ++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/htdocs/install/default.css b/htdocs/install/default.css index 6801eee4bcf..dabe41e82ce 100644 --- a/htdocs/install/default.css +++ b/htdocs/install/default.css @@ -117,13 +117,15 @@ color: #777711; /* Error */ div.error { -color: #550000; font-weight: bold; +color: #550000; +font-weight: bold; padding: 0.2em 0.2em 0.2em 0.2em; margin: 0.5em 0em 0.5em 0em; border: 1px solid #6C7C8B; } font.error { -color: #550000; font-weight: bold; +color: #550000; +font-weight: bold; } /* Next button */ diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index 7501e3cf066..59ea5ec8bba 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -78,7 +78,7 @@ if ($action == "set") { print '

'.$langs->trans("Database").'

'; - print ''; + print '
'; $error=0; $db=getDoliDBInstance($conf->db->type,$conf->db->host,$conf->db->user,$conf->db->pass,$conf->db->name,$conf->db->port); @@ -220,7 +220,7 @@ if ($action == "set") print ""; - print ""; + print ''; $error++; } } @@ -229,7 +229,7 @@ if ($action == "set") { print ""; - print ""; + print ''; $error++; dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR); } @@ -246,7 +246,7 @@ if ($action == "set") } else { - print ""; + print ''; dolibarr_install_syslog("Failed to find files to create database in directory ".$dir,LOG_ERR); } } @@ -367,7 +367,7 @@ if ($action == "set") print ""; - print ""; + print ''; $error++; } } @@ -378,7 +378,7 @@ if ($action == "set") { print ""; - print ""; + print '"; $error++; dolibarr_install_syslog("Failed to open file ".$dir.$file,LOG_ERR); } @@ -455,7 +455,7 @@ if ($action == "set") print ""; - print ""; + print ''; $error++; } } @@ -469,7 +469,7 @@ if ($action == "set") } else { - print ""; + print ''; $ok = 1 ; } @@ -546,7 +546,10 @@ if ($action == "set") dolibarr_install_syslog("Found ".$linefound." records, defined ".count($arrayofrequests)." group(s).",LOG_DEBUG); - // We loop on each requests + $okallfile=1; + $db->begin(); + + // We loop on each requests of file foreach($arrayofrequests as $buffer) { // Replace the prefix tables @@ -556,10 +559,9 @@ if ($action == "set") } //dolibarr_install_syslog("Request: ".$buffer,LOG_DEBUG); - $resql=$db->query($buffer); + $resql=$db->query($buffer,1); if ($resql) { - $ok = 1; //$db->free($resql); // Not required as request we launch here does not return memory needs. } else @@ -571,10 +573,14 @@ if ($action == "set") else { $ok = 0; - print $langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."
"; + $okallfile = 0; + print ''.$langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."
"; } } } + + if ($okallfile) $db->commit(); + else $db->rollback(); } } @@ -585,8 +591,8 @@ if ($action == "set") } else { - print ""; - $ok = 1 ; + print ''; + $ok = 1; // Data loading are not blocking errors } } print '
".$langs->trans("CreateTableAndPrimaryKey",$name); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer; print "\n
".$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error()."
'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'
".$langs->trans("CreateTableAndPrimaryKey",$name); print "".$langs->trans("Error")." Failed to open file ".$dir.$file."
'.$langs->trans("Error").' Failed to open file '.$dir.$file.'
".$langs->trans("ErrorFailedToFindSomeFiles",$dir)."".$langs->trans("Error")."
'.$langs->trans("ErrorFailedToFindSomeFiles",$dir).''.$langs->trans("Error").'
".$langs->trans("CreateOtherKeysForTable",$name); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$db->lastqueryerror(); print "\n
".$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error()."
'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'
".$langs->trans("CreateOtherKeysForTable",$name); print "".$langs->trans("Error")." Failed to open file ".$dir.$file."
'.$langs->trans("Error")." Failed to open file ".$dir.$file."
".$langs->trans("FunctionsCreation"); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer; print "\n
".$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error()."
'.$langs->trans("ErrorSQL")." ".$db->errno()." ".$db->error().'
".$langs->trans("Error")."
'.$langs->trans("Error").'
".$langs->trans("Error")."
'.$langs->trans("Error").'
';