2
0
forked from Wavyzz/dolibarr

More info on utf8 setup in database

This commit is contained in:
Laurent Destailleur
2008-12-20 18:37:30 +00:00
parent e7e7b35742
commit b398463aaa
5 changed files with 75 additions and 53 deletions

View File

@@ -1,5 +1,5 @@
<?php <?php
/* Copyright (C) 2007 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -14,15 +14,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/admin/limits.php \file htdocs/admin/limits.php
\brief Page de configuration des limites \brief Page de configuration des limites
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");

View File

@@ -17,15 +17,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/admin/system/database-tables.php \file htdocs/admin/system/database-tables.php
\brief Page d'infos des tables de la base \brief Page d'infos des tables de la base
\version $Revision$ \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
@@ -93,6 +90,7 @@ else
print '<td>Index_length</td>'; print '<td>Index_length</td>';
print '<td>Increment</td>'; print '<td>Increment</td>';
print '<td>Last check</td>'; print '<td>Last check</td>';
print '<td>Collation</td>';
print "</tr>\n"; print "</tr>\n";
$sql = "SHOW TABLE STATUS"; $sql = "SHOW TABLE STATUS";
@@ -127,6 +125,7 @@ else
print '<td align="right">'.$obj->Index_length.'</td>'; print '<td align="right">'.$obj->Index_length.'</td>';
print '<td align="right">'.$obj->Auto_increment.'</td>'; print '<td align="right">'.$obj->Auto_increment.'</td>';
print '<td align="right">'.$obj->Check_time.'</td>'; print '<td align="right">'.$obj->Check_time.'</td>';
print '<td align="right">'.$obj->Collation.'</td>';
print '</tr>'; print '</tr>';
$i++; $i++;
} }

View File

@@ -17,16 +17,13 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/ */
/** /**
\file htdocs/admin/system/database.php * \file htdocs/admin/system/database.php
\brief Page des infos syst<73>me de la base de donn<6E>e * \brief Page des infos syst<73>me de la base de donn<6E>e
\version $Revision$ * \version $Id$
*/ */
require("./pre.inc.php"); require("./pre.inc.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php"; include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
@@ -34,13 +31,15 @@ include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".li
$langs->load("admin"); $langs->load("admin");
if (!$user->admin) if (!$user->admin)
accessforbidden(); accessforbidden();
/* /*
* Afficahge page * Afficahge page
*/ */
$html=new Form($db);
llxHeader(); llxHeader();
@@ -84,6 +83,18 @@ else
print '<td>'.$langs->trans("Value").'</td>'; print '<td>'.$langs->trans("Value").'</td>';
print "</tr>\n"; print "</tr>\n";
// arraytest is an array of test to do
$arraytest=array();
if (eregi('mysql',$db->type))
{
$arraytest=array(
"character_set_connection"=>'character_set_client',
'character_set_database'=>'dolibarr_main_db_character_set',
'collation_connection'=>"character_set_client",
'collation_database'=>'dolibarr_main_db_collation'
);
}
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) if ($resql)
{ {
@@ -92,7 +103,22 @@ else
{ {
$var=!$var; $var=!$var;
print "<tr $bc[$var]>"; print "<tr $bc[$var]>";
print '<td>'.$row[0].'</td><td>'.$row[1]."</td></tr>\n"; print '<td>';
print $row[0];
print '</td>';
print '<td>';
$show=0;$text='';
foreach($arraytest as $key => $val)
{
if ($key != $row[0]) continue;
$text='Should be in line with value of param <b>'.$val.'</b> thas is <b>'.${$val}.'</b>';
$show=1;
}
if ($show==0) print $row[1];
if ($show==1) print $html->textwithhelp($row[1],$text);
if ($show==2) print $html->textwithwarning($row[1],$text);
print '</td>';
print "</tr>\n";
} }
$db->free($resql); $db->free($resql);
} }

View File

@@ -229,14 +229,14 @@ if (! $error && $db->connected)
$listOfCharacterSet=$db->getListOfCharacterSet(); $listOfCharacterSet=$db->getListOfCharacterSet();
$listOfCollation=$db->getListOfCollation(); $listOfCollation=$db->getListOfCollation();
// Choice of character_set_database // Choice of dolibarr_main_db_charaster_set
?> ?>
<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"><?php <td valign="top" class="label"><?php
if (sizeof($listOfCharacterSet)) if (sizeof($listOfCharacterSet))
{ {
print '<select name="character_set_database" '.$disabled.'>'; print '<select name="dolibarr_main_db_charaster_set" '.$disabled.'>';
$selected=""; $selected="";
foreach ($listOfCharacterSet as $characterSet) foreach ($listOfCharacterSet as $characterSet)
{ {
@@ -252,12 +252,12 @@ if (! $error && $db->connected)
} }
print '</select>'; print '</select>';
if ($disabled=="disabled"){ if ($disabled=="disabled"){
print '<input type="hidden" name="character_set_database" value="'.$defaultCharacterSet.'">'; print '<input type="hidden" name="dolibarr_main_db_charaster_set" value="'.$defaultCharacterSet.'">';
} }
} }
else else
{ {
print '<input type="text" name="character_set_database" value="'.$defaultCharacterSet.'">'; print '<input type="text" name="dolibarr_main_db_charaster_set" value="'.$defaultCharacterSet.'">';
} }
?></td> ?></td>
<td class="label"> <td class="label">

View File

@@ -149,7 +149,7 @@ if ($_POST["action"] == "set")
fputs($fp, '$dolibarr_main_db_type="'.$_POST["db_type"].'";'); fputs($fp, '$dolibarr_main_db_type="'.$_POST["db_type"].'";');
fputs($fp,"\n"); fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_character_set="'.$_POST["character_set_database"].'";'); fputs($fp, '$dolibarr_main_db_character_set="'.$_POST["dolibarr_main_db_charaster_set"].'";');
fputs($fp,"\n"); fputs($fp,"\n");
fputs($fp, '$dolibarr_main_db_collation="'.$_POST["dolibarr_main_db_collation"].'";'); fputs($fp, '$dolibarr_main_db_collation="'.$_POST["dolibarr_main_db_collation"].'";');