Add more log in install process

This commit is contained in:
Laurent Destailleur 2008-12-18 01:06:12 +00:00
parent c2db14f348
commit cf4d0361db
8 changed files with 78 additions and 60 deletions

View File

@ -18,11 +18,11 @@
*/ */
/** /**
\file htdocs/install/etape0.php \file htdocs/install/etape0.php
\ingroup install \ingroup install
\brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion' \brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion'
\version $Id$ \version $Id$
*/ */
define('DONOTLOADCONF',1); // To avoid loading conf by file inc.php define('DONOTLOADCONF',1); // To avoid loading conf by file inc.php
@ -50,8 +50,8 @@ dolibarr_install_syslog("etape0: Entering etape0.php page");
/* /*
* View * View
*/ */
pHeader($langs->trans("ConfigurationFile"),"etape1"); pHeader($langs->trans("ConfigurationFile"),"etape1");
@ -59,11 +59,11 @@ pHeader($langs->trans("ConfigurationFile"),"etape1");
if ($_POST["action"] == "set") if ($_POST["action"] == "set")
{ {
umask(0); umask(0);
foreach($_POST as $cle=>$valeur) foreach($_POST as $cle=>$valeur)
{ {
echo '<input type="hidden" name="'.$cle.'" value="'.$valeur.'">'; echo '<input type="hidden" name="'.$cle.'" value="'.$valeur.'">';
if (! eregi('^db_pass',$cle)) dolibarr_install_syslog("Choice for ".$cle." = ".$valeur); if (! eregi('^db_pass',$cle)) dolibarr_install_syslog("Choice for ".$cle." = ".$valeur);
} }
} }
// Check parameters // Check parameters
@ -90,8 +90,8 @@ if (empty($_POST["db_user"]))
/** /**
* Tentative de connexion a la base * Tentative de connexion a la base
*/ */
if (! $error) if (! $error)
{ {
$result=include_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php"); $result=include_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php");
@ -180,15 +180,15 @@ if (! $error)
else else
{ {
if (isset($db)) print $db->lasterror(); if (isset($db)) print $db->lasterror();
if (isset($db) && ! $db->connected) print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>'; if (isset($db) && ! $db->connected) print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
print $langs->trans("ErrorGoBackAndCorrectParameters"); print $langs->trans("ErrorGoBackAndCorrectParameters");
$error++; $error++;
} }
/* /*
* Si creation database demandée, il est possible de faire un choix * Si creation database demandée, il est possible de faire un choix
*/ */
$disabled=""; $disabled="";
if (! $error && ! empty($_POST["db_create_database"])) if (! $error && ! empty($_POST["db_create_database"]))
{ {
@ -215,9 +215,13 @@ if (! $error && $db->connected)
if (! $error && $db->connected) if (! $error && $db->connected)
{ {
?> ?>
<table border="0" cellpadding="1" cellspacing="0"> <table border="0" cellpadding="1" cellspacing="0">
<tr><td align="center" class="label" colspan="3"><h3><?php echo $langs->trans("CharsetChoice");?></h3></td></tr> <tr>
<td align="center" class="label" colspan="3">
<h3><?php echo $langs->trans("CharsetChoice");?></h3>
</td>
</tr>
<?php <?php
$defaultCharacterSet=$db->getDefaultCharacterSetDatabase(); $defaultCharacterSet=$db->getDefaultCharacterSetDatabase();
@ -225,12 +229,11 @@ if (! $error && $db->connected)
$listOfCharacterSet=$db->getListOfCharacterSet(); $listOfCharacterSet=$db->getListOfCharacterSet();
$listOfCollation=$db->getListOfCollation(); $listOfCollation=$db->getListOfCollation();
// Choice of character_set_database
?> ?>
<tr> <tr>
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td> <td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td>
<td valign="top" class="label"> <td valign="top" class="label"><?php
<?php
if (sizeof($listOfCharacterSet)) if (sizeof($listOfCharacterSet))
{ {
print '<select name="character_set_database" '.$disabled.'>'; print '<select name="character_set_database" '.$disabled.'>';
@ -256,20 +259,20 @@ if (! $error && $db->connected)
{ {
print '<input type="text" name="character_set_database" value="'.$defaultCharacterSet.'">'; print '<input type="text" name="character_set_database" value="'.$defaultCharacterSet.'">';
} }
?> ?></td>
<td class="label">
<div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div>
</td> </td>
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div></td> </tr>
</tr> <?php
<?php
// Choice of dolibarr_main_db_collation
if ($defaultCollationConnection) if ($defaultCollationConnection)
{ {
?> ?>
<tr> <tr>
<td valign="top" class="label"><?php echo $langs->trans("CollationConnection"); ?></td> <td valign="top" class="label"><?php echo $langs->trans("CollationConnection"); ?></td>
<td valign="top" class="label"> <td valign="top" class="label"><?php
<?php
if (sizeof($listOfCollation)) if (sizeof($listOfCollation))
{ {
print '<select name="dolibarr_main_db_collation" '.$disabled.'>'; print '<select name="dolibarr_main_db_collation" '.$disabled.'>';
@ -295,16 +298,17 @@ if (! $error && $db->connected)
{ {
print '<input type="text" name="dolibarr_main_db_collation" value="'.$defaultCollationConnection.'">'; print '<input type="text" name="dolibarr_main_db_collation" value="'.$defaultCollationConnection.'">';
} }
?> ?></td>
<td class="label">
<div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div>
</td> </td>
<td class="label"><div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div></td> </tr>
</tr>
<?php
}
?>
</table>
<?php <?php
} }
?>
</table>
<?php
}
pFooter($error,$setuplang); pFooter($error,$setuplang);

View File

@ -77,6 +77,11 @@ if (! $main_data_dir) { $main_data_dir="$main_dir/documents"; }
if ($_POST["action"] == "set") if ($_POST["action"] == "set")
{ {
umask(0); umask(0);
foreach($_POST as $cle=>$valeur)
{
if (! eregi('^db_pass',$cle)) dolibarr_install_syslog("Choice for ".$cle." = ".$valeur);
}
print '<h3>'.$langs->trans("ConfigurationFile").'</h3>'; print '<h3>'.$langs->trans("ConfigurationFile").'</h3>';
print '<table cellspacing="0" width="100%" cellpadding="1" border="0">'; print '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
@ -153,11 +158,11 @@ if ($_POST["action"] == "set")
/* Authentication */ /* Authentication */
if ($_POST["db_type"] == 'mssql') if ($_POST["db_type"] == 'mssql')
{ {
fputs($fp, '$dolibarr_main_authentication="dolibarr_mdb2";'); fputs($fp, '$dolibarr_main_authentication="dolibarr_mdb2";');
} }
else else
{ {
fputs($fp, '$dolibarr_main_authentication="dolibarr";'); fputs($fp, '$dolibarr_main_authentication="dolibarr";');
} }
fputs($fp,"\n"); fputs($fp,"\n");
@ -381,8 +386,7 @@ if ($_POST["action"] == "set")
*/ */
if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on")) if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on"))
{ {
dolibarr_install_syslog("etape1: Creation de la base : ".$dolibarr_main_db_name); dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name);
$db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port); $db = new DoliDb($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
if ($db->connected) if ($db->connected)
@ -507,8 +511,9 @@ if ($_POST["action"] == "set")
print "</td></tr>"; print "</td></tr>";
// Affiche aide diagnostique // Affiche aide diagnostique
print '<tr><td colspan="2"><br>Le serveur "<b>'.$conf->db->host.'</b>", nom de base "<b>'.$conf->db->name.'</b>", login "<b>'.$conf->db->user.'</b>", ou mot de passe de la base de donnée est peut-être incorrect ou la version du client PHP trop ancienne par rapport à la version de la base de donnée.<br>'; print '<tr><td colspan="2"><br>';
print 'Si le login n\'existe pas encore, vous devez cocher l\'option "Créer l\'utilisateur".<br>'; print $langs->trans("ErrorConnection",$conf->db->host,$conf->db->name,$conf->db->user);
print $langs->trans('IfLoginDoesNotExistsCheckCreateUser').'<br>';
print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>'; print $langs->trans("ErrorGoBackAndCorrectParameters").'<br><br>';
print '</td></tr>'; print '</td></tr>';
@ -521,5 +526,4 @@ if ($_POST["action"] == "set")
} }
pFooter($error,$setuplang); pFooter($error,$setuplang);
?> ?>

View File

@ -139,9 +139,6 @@ if (file_exists('../../install.lock'))
} }
// Forcage constante LOG
// Forcage du log pour les install et mises a jour // Forcage du log pour les install et mises a jour
$conf->syslog->enabled=1; $conf->syslog->enabled=1;
$conf->global->SYSLOG_LEVEL=constant('LOG_DEBUG'); $conf->global->SYSLOG_LEVEL=constant('LOG_DEBUG');
@ -216,6 +213,15 @@ function conf($dolibarr_main_document_root)
if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation='latin1_swedish_ci'; if (empty($dolibarr_main_db_collation)) $dolibarr_main_db_collation='latin1_swedish_ci';
$conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation; $conf->db->dolibarr_main_db_collation=$dolibarr_main_db_collation;
// Forcage du log pour les install et mises a jour
$conf->syslog->enabled=1;
$conf->global->SYSLOG_LEVEL=constant('LOG_DEBUG');
if (@is_writable('/tmp')) define('SYSLOG_FILE','/tmp/dolibarr_install.log');
else if (! empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"])) define('SYSLOG_FILE',$_ENV["TMP"].'/dolibarr_install.log');
else if (! empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"])) define('SYSLOG_FILE',$_ENV["TEMP"].'/dolibarr_install.log');
else if (@is_writable("/")) define('SYSLOG_FILE','/dolibarr_install.log');
define('SYSLOG_FILE_NO_ERROR',1);
return 1; return 1;
} }

View File

@ -126,6 +126,8 @@ OrphelinsPaymentsDetectedByMethod=Orphelins payment detected by method %s
RemoveItManuallyAndPressF5ToContinue=Remove it manually and press F5 to continue. RemoveItManuallyAndPressF5ToContinue=Remove it manually and press F5 to continue.
KeepDefaultValues=You use the Doliwamp setup wizard, so values proposed here are already optimized. Change them only if you know what you do. KeepDefaultValues=You use the Doliwamp setup wizard, so values proposed here are already optimized. Change them only if you know what you do.
FieldRenamed=Field renamed FieldRenamed=Field renamed
IfLoginDoesNotExistsCheckCreateUser=If login does not exists yet, you must check option "Create user"
ErrorConnection=Server "<b>%s</b>", database name "<b>%s</b>", login "<b>%s</b>", or database password may be wrong or PHP client version may be too old compared to database version.
######### #########
# upgrade # upgrade

View File

@ -126,6 +126,8 @@ OrphelinsPaymentsDetectedByMethod=Paiement orphelins detect
RemoveItManuallyAndPressF5ToContinue=Supprimer le manuellement et appuyez sur F5 pour continuer. RemoveItManuallyAndPressF5ToContinue=Supprimer le manuellement et appuyez sur F5 pour continuer.
KeepDefaultValues=Comme vous utilisez l'assistant d'installation depuis DoliWamp, les valeurs proposées aux paramètres sont déjà optimisées. Ne les modifier qu'en connaissance de cause. KeepDefaultValues=Comme vous utilisez l'assistant d'installation depuis DoliWamp, les valeurs proposées aux paramètres sont déjà optimisées. Ne les modifier qu'en connaissance de cause.
FieldRenamed=Champ renommé FieldRenamed=Champ renommé
IfLoginDoesNotExistsCheckCreateUser=Si le login n'existe pas encore, vous devez cocher l'option "Créer l'utilisateur"
ErrorConnection=Le serveur "<b>%s</b>", nom de base "<b>%s</b>", login "<b>%s</b>", ou mot de passe de la base de donnée est peut-être incorrect ou la version du client PHP trop ancienne par rapport à la version de la base de donnée.
######### #########
# upgrade # upgrade

View File

@ -882,7 +882,7 @@ class DoliDb
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')"; $sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')";
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');";
dolibarr_syslog("mysql.lib::DDLCreateUser sql=".$sql); dolibarr_syslog("mysql.lib::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
$resql=$this->query($sql); $resql=$this->query($sql);
if (! $resql) if (! $resql)
{ {

View File

@ -896,7 +896,7 @@ class DoliDb
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')"; $sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')";
$sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');"; $sql.= ",'Y','Y','Y','Y','Y','Y','Y','Y');";
dolibarr_syslog("mysqli.lib::DDLCreateUser sql=".$sql); dolibarr_syslog("mysqli.lib::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
$resql=$this->query($sql); $resql=$this->query($sql);
if (! $resql) if (! $resql)
{ {

View File

@ -833,7 +833,7 @@ class DoliDb
{ {
$sql = "create user \"".$dolibarr_main_db_user."\" with password '".$dolibarr_main_db_pass."'"; $sql = "create user \"".$dolibarr_main_db_user."\" with password '".$dolibarr_main_db_pass."'";
dolibarr_syslog("pgsql.lib::DDLCreateUser sql=".$sql); dolibarr_syslog("pgsql.lib::DDLCreateUser", LOG_DEBUG); // No sql to avoid password in log
$resql=$this->query($sql); $resql=$this->query($sql);
if (! $resql) if (! $resql)
{ {