Add more log in install process
This commit is contained in:
parent
c2db14f348
commit
cf4d0361db
@ -18,11 +18,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/install/etape0.php
|
||||
\ingroup install
|
||||
\brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion'
|
||||
\version $Id$
|
||||
*/
|
||||
\file htdocs/install/etape0.php
|
||||
\ingroup install
|
||||
\brief Permet d'afficher et de confirmer le charset par rapport aux informations précédentes -> sélection suite à connexion'
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
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");
|
||||
|
||||
@ -59,11 +59,11 @@ pHeader($langs->trans("ConfigurationFile"),"etape1");
|
||||
if ($_POST["action"] == "set")
|
||||
{
|
||||
umask(0);
|
||||
foreach($_POST as $cle=>$valeur)
|
||||
{
|
||||
echo '<input type="hidden" name="'.$cle.'" value="'.$valeur.'">';
|
||||
foreach($_POST as $cle=>$valeur)
|
||||
{
|
||||
echo '<input type="hidden" name="'.$cle.'" value="'.$valeur.'">';
|
||||
if (! eregi('^db_pass',$cle)) dolibarr_install_syslog("Choice for ".$cle." = ".$valeur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
$result=include_once($main_dir."/lib/databases/".$_POST["db_type"].".lib.php");
|
||||
@ -117,7 +117,7 @@ if (! $error)
|
||||
|
||||
// If we need root access
|
||||
if (! $error && (! empty($_POST["db_create_database"]) || ! empty($_POST["db_create_user"])))
|
||||
{
|
||||
{
|
||||
$databasefortest=$_POST["db_name"];
|
||||
if (! empty($_POST["db_create_database"]))
|
||||
{
|
||||
@ -136,7 +136,7 @@ if (! $error)
|
||||
}
|
||||
//print $_POST["db_type"].",".$_POST["db_host"].",$userroot,$passroot,$databasefortest,".$_POST["db_port"];
|
||||
$db = new DoliDb($_POST["db_type"],$_POST["db_host"],$userroot,$passroot,$databasefortest,$_POST["db_port"]);
|
||||
|
||||
|
||||
dolibarr_syslog("databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected, LOG_DEBUG);
|
||||
//print "databasefortest=".$databasefortest." connected=".$db->connected." database_selected=".$db->database_selected;
|
||||
|
||||
@ -147,7 +147,7 @@ if (! $error)
|
||||
if (! $db->connected) print $langs->trans("IfDatabaseNotExistsGoBackAndUncheckCreate").'<br><br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters");
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
elseif ($db->error && ! (! empty($_POST["db_create_database"]) && $db->connected))
|
||||
{
|
||||
print '<div class="error">'.$db->error.'</div>';
|
||||
@ -158,7 +158,7 @@ if (! $error)
|
||||
}
|
||||
// If we need simple access
|
||||
if (! $error && (empty($_POST["db_create_database"]) && empty($_POST["db_create_user"])))
|
||||
{
|
||||
{
|
||||
$db = new DoliDb($_POST["db_type"],$_POST["db_host"],$_POST["db_user"],$_POST["db_pass"],$_POST["db_name"],$_POST["db_port"]);
|
||||
if ($db->error)
|
||||
{
|
||||
@ -180,15 +180,15 @@ if (! $error)
|
||||
|
||||
else
|
||||
{
|
||||
if (isset($db)) print $db->lasterror();
|
||||
if (isset($db) && ! $db->connected) print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters");
|
||||
$error++;
|
||||
if (isset($db)) print $db->lasterror();
|
||||
if (isset($db) && ! $db->connected) print '<br>'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'<br><br>';
|
||||
print $langs->trans("ErrorGoBackAndCorrectParameters");
|
||||
$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="";
|
||||
if (! $error && ! empty($_POST["db_create_database"]))
|
||||
{
|
||||
@ -215,22 +215,25 @@ if (! $error && $db->connected)
|
||||
if (! $error && $db->connected)
|
||||
{
|
||||
?>
|
||||
<table border="0" cellpadding="1" cellspacing="0">
|
||||
|
||||
<tr><td align="center" class="label" colspan="3"><h3><?php echo $langs->trans("CharsetChoice");?></h3></td></tr>
|
||||
|
||||
<table border="0" cellpadding="1" cellspacing="0">
|
||||
|
||||
<tr>
|
||||
<td align="center" class="label" colspan="3">
|
||||
<h3><?php echo $langs->trans("CharsetChoice");?></h3>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$defaultCharacterSet=$db->getDefaultCharacterSetDatabase();
|
||||
$defaultCollationConnection=$db->getDefaultCollationDatabase();
|
||||
$listOfCharacterSet=$db->getListOfCharacterSet();
|
||||
$listOfCollation=$db->getListOfCollation();
|
||||
|
||||
|
||||
?>
|
||||
<tr>
|
||||
// Choice of character_set_database
|
||||
?>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CharacterSetDatabase"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
<td valign="top" class="label"><?php
|
||||
if (sizeof($listOfCharacterSet))
|
||||
{
|
||||
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.'">';
|
||||
}
|
||||
?>
|
||||
?></td>
|
||||
<td class="label">
|
||||
<div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CharacterSetDatabaseComment"); ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
// Choice of dolibarr_main_db_collation
|
||||
if ($defaultCollationConnection)
|
||||
{
|
||||
?>
|
||||
<tr>
|
||||
<tr>
|
||||
<td valign="top" class="label"><?php echo $langs->trans("CollationConnection"); ?></td>
|
||||
<td valign="top" class="label">
|
||||
<?php
|
||||
<td valign="top" class="label"><?php
|
||||
if (sizeof($listOfCollation))
|
||||
{
|
||||
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.'">';
|
||||
}
|
||||
?>
|
||||
?></td>
|
||||
<td class="label">
|
||||
<div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div>
|
||||
</td>
|
||||
<td class="label"><div class="comment"><?php echo $langs->trans("CollationConnectionComment"); ?></div></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
pFooter($error,$setuplang);
|
||||
|
||||
@ -77,6 +77,11 @@ if (! $main_data_dir) { $main_data_dir="$main_dir/documents"; }
|
||||
if ($_POST["action"] == "set")
|
||||
{
|
||||
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 '<table cellspacing="0" width="100%" cellpadding="1" border="0">';
|
||||
|
||||
@ -153,11 +158,11 @@ if ($_POST["action"] == "set")
|
||||
/* Authentication */
|
||||
if ($_POST["db_type"] == 'mssql')
|
||||
{
|
||||
fputs($fp, '$dolibarr_main_authentication="dolibarr_mdb2";');
|
||||
fputs($fp, '$dolibarr_main_authentication="dolibarr_mdb2";');
|
||||
}
|
||||
else
|
||||
{
|
||||
fputs($fp, '$dolibarr_main_authentication="dolibarr";');
|
||||
fputs($fp, '$dolibarr_main_authentication="dolibarr";');
|
||||
}
|
||||
fputs($fp,"\n");
|
||||
|
||||
@ -381,8 +386,7 @@ if ($_POST["action"] == "set")
|
||||
*/
|
||||
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);
|
||||
|
||||
if ($db->connected)
|
||||
@ -507,8 +511,9 @@ if ($_POST["action"] == "set")
|
||||
print "</td></tr>";
|
||||
|
||||
// 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 'Si le login n\'existe pas encore, vous devez cocher l\'option "Créer l\'utilisateur".<br>';
|
||||
print '<tr><td colspan="2"><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 '</td></tr>';
|
||||
|
||||
@ -521,5 +526,4 @@ if ($_POST["action"] == "set")
|
||||
}
|
||||
|
||||
pFooter($error,$setuplang);
|
||||
|
||||
?>
|
||||
|
||||
@ -139,9 +139,6 @@ if (file_exists('../../install.lock'))
|
||||
}
|
||||
|
||||
|
||||
// Forcage constante LOG
|
||||
|
||||
|
||||
// Forcage du log pour les install et mises a jour
|
||||
$conf->syslog->enabled=1;
|
||||
$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';
|
||||
$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;
|
||||
}
|
||||
|
||||
|
||||
@ -126,6 +126,8 @@ OrphelinsPaymentsDetectedByMethod=Orphelins payment detected by method %s
|
||||
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.
|
||||
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
|
||||
|
||||
@ -126,6 +126,8 @@ OrphelinsPaymentsDetectedByMethod=Paiement orphelins detect
|
||||
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.
|
||||
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
|
||||
|
||||
@ -882,7 +882,7 @@ class DoliDb
|
||||
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')";
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
|
||||
@ -896,7 +896,7 @@ class DoliDb
|
||||
$sql.= " VALUES ('$dolibarr_main_db_host','$dolibarr_main_db_user',password('$dolibarr_main_db_pass')";
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
|
||||
@ -833,7 +833,7 @@ class DoliDb
|
||||
{
|
||||
$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);
|
||||
if (! $resql)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user