2
0
forked from Wavyzz/dolibarr

Fix: Log not reported

Fix: charset not correctly forced

Conflicts:
	htdocs/install/inc.php
This commit is contained in:
Laurent Destailleur
2013-01-28 11:56:45 +01:00
parent 2002388098
commit abd8aea06b
2 changed files with 28 additions and 6 deletions

View File

@@ -255,8 +255,10 @@ if (! $error && $db->connected)
{
if (! empty($_POST["db_create_database"])) // If we create database, we force default value
{
$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
$defaultDBSortingCollation=getStaticMember(get_class($db),'forcecollate');
//$defaultCharacterSet=getStaticMember(get_class($db),'forcecharset');
//$defaultDBSortingCollation=getStaticMember(get_class($db),'forcecollate');
$defaultCharacterSet=$db->forcecharset;
$defaultDBSortingCollation=$db->forcecollate;
}
else // If already created, we take current value
{
@@ -268,6 +270,7 @@ if (! $error && $db->connected)
print '<input type="hidden" name="dolibarr_main_db_collation" value="'.$defaultDBSortingCollation.'">';
$db_character_set=$defaultCharacterSet;
$db_collation=$defaultDBSortingCollation;
dolibarr_install_syslog("db_character_set=".$db_character_set." db_collation=".$db_collation);
}
@@ -559,8 +562,8 @@ if (! $error && $db->connected && $action == "set")
// If database creation is asked, we create it
if (! $error && (isset($_POST["db_create_database"]) && $_POST["db_create_database"] == "on"))
{
dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name, LOG_DEBUG);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
dolibarr_install_syslog("etape1: Create database : ".$dolibarr_main_db_name." ".$dolibarr_main_db_character_set." ".$dolibarr_main_db_collation." ".$dolibarr_main_db_user, LOG_DEBUG);
$newdb=getDoliDBInstance($conf->db->type,$conf->db->host,$userroot,$passroot,'',$conf->db->port);
//print 'eee'.$conf->db->type." ".$conf->db->host." ".$userroot." ".$passroot." ".$conf->db->port." ".$newdb->connected." ".$newdb->forcecharset;exit;
if ($newdb->connected)

View File

@@ -200,6 +200,7 @@ if (constant('DOL_DATA_ROOT') && file_exists($lockfile))
// Force usage of log file for install and upgrades
$conf->syslog->enabled=1;
$conf->global->SYSLOG_LEVEL=constant('LOG_DEBUG');
if (! defined('SYSLOG_HANDLERS')) define('SYSLOG_HANDLERS','["mod_syslog_file"]');
if (! defined('SYSLOG_FILE')) // To avoid warning on systems with constant already defined
{
if (@is_writable('/tmp')) define('SYSLOG_FILE','/tmp/dolibarr_install.log');
@@ -230,7 +231,6 @@ foreach ($handlers as $handler)
$conf->loghandlers[]=$loghandlerinstance;
}
// Removed magic_quotes
if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5.4
{
@@ -314,7 +314,26 @@ function conf($dolibarr_main_document_root)
//print 'SYSLOG_FILE='.SYSLOG_FILE;exit;
}
if (! defined('SYSLOG_FILE_NO_ERROR')) define('SYSLOG_FILE_NO_ERROR',1);
// We init log handler for install
$handlers = array('mod_syslog_file');
foreach ($handlers as $handler)
{
$file = DOL_DOCUMENT_ROOT.'/core/modules/syslog/'.$handler.'.php';
if (!file_exists($file))
{
throw new Exception('Missing log handler file '.$handler.'.php');
}
require_once $file;
$loghandlerinstance = new $handler();
if (!$loghandlerinstance instanceof LogHandlerInterface)
{
throw new Exception('Log handler does not extend LogHandlerInterface');
}
$conf->loghandlers[]=$loghandlerinstance;
}
return 1;
}