From bd34a5416f5a2d45c0811e7585a5e1e8d2bc5e17 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 31 Dec 2007 13:12:27 +0000 Subject: [PATCH] Ajout test que fichiers bases presents --- htdocs/install/etape2.php | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/htdocs/install/etape2.php b/htdocs/install/etape2.php index c1a7839cbc0..183ae7a7f75 100644 --- a/htdocs/install/etape2.php +++ b/htdocs/install/etape2.php @@ -117,12 +117,14 @@ if ($_POST["action"] == "set") $ok = 0; $handle=opendir($dir); dolibarr_install_syslog("Ouverture repertoire ".$dir." handle=".$handle,LOG_DEBUG); - $table_exists = 0; + $tablefound = 0; while (($file = readdir($handle))!==false) { if (eregi('\.sql$',$file) && eregi('^llx_',$file) && ! eregi('\.key\.sql$',$file)) { - $name = substr($file, 0, strlen($file) - 4); + $tablefound++; + + $name = substr($file, 0, strlen($file) - 4); $buffer = ''; $fp = fopen($dir.$file,"r"); if ($fp) @@ -178,12 +180,20 @@ if ($_POST["action"] == "set") } closedir($handle); - if ($error == 0) + if ($tablefound) { - print ''; - print $langs->trans("TablesAndPrimaryKeysCreation").''.$langs->trans("OK").''; - $ok = 1; + if ($error == 0) + { + print ''; + print $langs->trans("TablesAndPrimaryKeysCreation").''.$langs->trans("OK").''; + $ok = 1; + } } + else + { + print "".$langs->trans("ErrorFailedToFindSomeFiles",$dir)."".$langs->trans("Error").""; + dolibarr_install_syslog("Failed to find files to create database in directory ".$dir,LOG_ERR); + } }