#239 Issue with character set (impacting searches with accents)

SVN:trunk[746]
This commit is contained in:
Romain Quetiez
2010-09-02 15:25:57 +00:00
parent 400e2916d0
commit 66c7d99c46
4 changed files with 51 additions and 0 deletions

View File

@@ -33,6 +33,9 @@ class ConfigException extends CoreException
{
}
define ('DEFAULT_CHARACTER_SET', 'utf8');
define ('DEFAULT_COLLATION', 'utf8_general_ci');
define ('DEFAULT_LOG_GLOBAL', true);
define ('DEFAULT_LOG_NOTIFICATION', true);
define ('DEFAULT_LOG_ISSUE', true);
@@ -73,6 +76,8 @@ class Config
protected $m_sDBPwd;
protected $m_sDBName;
protected $m_sDBSubname;
protected $m_sDBCharacterSet;
protected $m_sDBCollation;
/**
* @var integer Event log options (see LOG_... definition)
@@ -182,6 +187,8 @@ class Config
$this->m_sDBPwd = '';
$this->m_sDBName = '';
$this->m_sDBSubname = '';
$this->m_sDBCharacterSet = DEFAULT_CHARACTER_SET;
$this->m_sDBCollation = DEFAULT_COLLATION;
$this->m_bLogGlobal = DEFAULT_LOG_GLOBAL;
$this->m_bLogNotification = DEFAULT_LOG_NOTIFICATION;
$this->m_bLogIssue = DEFAULT_LOG_ISSUE;
@@ -284,6 +291,9 @@ class Config
$this->m_sDBName = trim($MySettings['db_name']);
$this->m_sDBSubname = trim($MySettings['db_subname']);
$this->m_sDBCharacterSet = isset($MySettings['db_character_set']) ? trim($MySettings['db_character_set']) : DEFAULT_CHARACTER_SET;
$this->m_sDBCollation = isset($MySettings['db_collation']) ? trim($MySettings['db_collation']) : DEFAULT_COLLATION;
$this->m_bLogGlobal = isset($MySettings['log_global']) ? (bool) trim($MySettings['log_global']) : DEFAULT_LOG_GLOBAL;
$this->m_bLogNotification = isset($MySettings['log_notification']) ? (bool) trim($MySettings['log_notification']) : DEFAULT_LOG_NOTIFICATION;
$this->m_bLogIssue = isset($MySettings['log_issue']) ? (bool) trim($MySettings['log_issue']) : DEFAULT_LOG_ISSUE;
@@ -391,6 +401,16 @@ class Config
return $this->m_sDBSubname;
}
public function GetDBCharacterSet()
{
return $this->m_sDBCharacterSet;
}
public function GetDBCollation()
{
return $this->m_sDBCollation;
}
public function GetDBUser()
{
return $this->m_sDBUser;
@@ -501,6 +521,16 @@ class Config
$this->m_sDBSubname = $sDBSubName;
}
public function SetDBCharacterSet($sDBCharacterSet)
{
$this->m_sDBCharacterSet = $sDBCharacterSet;
}
public function SetDBCollation($sDBCollation)
{
$this->m_sDBCollation = $sDBCollation;
}
public function SetDBUser($sUser)
{
$this->m_sDBUser = $sUser;
@@ -626,6 +656,8 @@ class Config
fwrite($hFile, "\t'db_pwd' => '".addslashes($this->m_sDBPwd)."',\n");
fwrite($hFile, "\t'db_name' => '{$this->m_sDBName}',\n");
fwrite($hFile, "\t'db_subname' => '{$this->m_sDBSubname}',\n");
fwrite($hFile, "\t'db_character_set' => '{$this->m_sDBCharacterSet}',\n");
fwrite($hFile, "\t'db_collation' => '{$this->m_sDBCollation}',\n");
fwrite($hFile, "\n");
fwrite($hFile, "\t'log_global' => {$this->m_bLogGlobal},\n");
fwrite($hFile, "\t'log_notification' => {$this->m_bLogNotification},\n");