28require
'../../main.inc.php';
32$action =
GETPOST(
'action',
'aZ09');
43if ($action ==
'convertutf8unicode') {
44 $sql =
"ALTER DATABASE ".$db->sanitize($db->database_name).
" CHARACTER SET utf8 COLLATE utf8_unicode_ci";
47if ($action ==
'convertutf8mb4unicode') {
48 $sql =
"ALTER DATABASE ".$db->sanitize($db->database_name).
" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
51if ($action ==
'convertutf8general') {
52 $sql =
"ALTER DATABASE ".$db->sanitize($db->database_name).
" CHARACTER SET utf8 COLLATE utf8_general_ci";
55if ($action ==
'convertutf8mb4general') {
56 $sql =
"ALTER DATABASE ".$db->sanitize($db->database_name).
" CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
67llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-system_database');
72print
'<div class="div-table-responsive-no-min">';
73print
'<table class="noborder centpercent">';
74print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Database").
'</td></tr>'.
"\n";
75print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"Version").
'</td><td>'.$db::LABEL.
' '.$db->getVersion().
'</td></tr>'.
"\n";
76print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DatabaseServer").
'</td><td>'.$conf->db->host.
'</td></tr>'.
"\n";
77print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DatabasePort").
'</td><td>'.(empty($conf->db->port) ? $langs->trans(
"Default") : $conf->db->port).
'</td></tr>'.
"\n";
78print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DatabaseName").
'</td><td>'.$conf->db->name.
'</td></tr>'.
"\n";
79print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DriverType").
'</td><td>'.$conf->db->type.($db->getDriverInfo() ?
' ('.$db->getDriverInfo().
')' :
'').
'</td></tr>'.
"\n";
81print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"User").
'</td><td>'.$conf->db->user.
'</td></tr>'.
"\n";
82print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"Password").
'</td><td>'.preg_replace(
'/./i',
'*', $dolibarr_main_db_pass).
'</td></tr>'.
"\n";
83print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DBStoringCharset").
'</td><td>'.$db->getDefaultCharacterSetDatabase();
84if ($db->type ==
'mysqli') {
85 $tooltipexample =
"<br>SHOW VARIABLES LIKE 'character_set_database' (cached)<br>You can avoid cache effect with:<br>SELECT DEFAULT_CHARACTER_SET_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '".$db->escape($conf->db->name).
"'";
86 print
' '.$form->textwithpicto(
'', $langs->transnoentitiesnoconv(
"HelpMariaDBToGetValue", $tooltipexample.
'<br>'.$langs->transnoentitiesnoconv(
"HelpMariaDBToGetPossibleValues",
"<br>SHOW CHARSET")));
89print
'</td></tr>'.
"\n";
90print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DBSortingCharset").
'</td><td>';
91$defaultcollation = $db->getDefaultCollationDatabase();
93if ($db->type ==
'mysqli') {
94 if ($defaultcollation != $conf->db->dolibarr_main_db_collation) {
95 print
img_warning(
'The database default value of collation '.$defaultcollation.
' differs from conf setup '.$conf->db->dolibarr_main_db_collation);
97 $tooltipexample =
"<br>SHOW VARIABLES LIKE 'collation_database' (cached)<br>You can avoid cache effect with:<br>SELECT DEFAULT_COLLATION_NAME FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '".$db->escape($conf->db->name).
"'";
98 print
' '.$form->textwithpicto(
'', $langs->transnoentitiesnoconv(
"HelpMariaDBToGetValue", $tooltipexample.
'<br>'.$langs->transnoentitiesnoconv(
"HelpMariaDBToGetPossibleValues",
"<br>SHOW COLLATION")));
101 print
' <span class="opacitymedium small">'.$langs->trans(
"ConvertInto");
102 if (!in_array($defaultcollation, array(
"utf8_unicode_ci"))) {
103 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8unicode&token='.
newToken().
'">utf8 unicode</a>';
105 if (!in_array($defaultcollation, array(
"utf8_general_ci"))) {
106 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8general&token='.
newToken().
'">utf8 general</a>';
108 if (!in_array($defaultcollation, array(
"utf8mb4_unicode_ci"))) {
109 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8mb4unicode&&token='.
newToken().
'">utf8mb4 unicode</a>';
111 if (!in_array($defaultcollation, array(
"utf8mb4_general_ci"))) {
112 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8mb4general&&token='.
newToken().
'">utf8mb4 general</a>';
115print
'</td></tr>'.
"\n";
121print
'<div class="div-table-responsive-no-min">';
122print
'<table class="noborder centpercent">';
123print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Tables").
'</td></tr>'.
"\n";
124print
'<tr class="oddeven"><td class=""><a href="'.DOL_URL_ROOT.
'/admin/system/database-tables.php?mainmenu=home">'.
img_picto(
'',
'list',
'class="pictofixedwidth"').$langs->trans(
"List").
'</a></td></tr>'.
"\n";
128$listofvars = $db->getServerParametersValues();
129$listofstatus = $db->getServerStatusValues();
130$arraylist = array(
'listofvars',
'listofstatus');
132if (!count($listofvars) && !count($listofstatus)) {
133 print $langs->trans(
"FeatureNotAvailableWithThisDatabaseDriver");
135 foreach ($arraylist as $listname) {
137 print
'<div class="div-table-responsive-no-min">';
138 print
'<table class="noborder centpercent">';
139 print
'<tr class="liste_titre">';
140 print
'<td width="300">'.$langs->trans(
"Parameters").
'</td>';
141 print
'<td>'.$langs->trans(
"Value").
'</td>';
145 $arraytest = array();
146 if (preg_match(
'/mysql/i', $db->type)) {
148 'character_set_database' => array(
'var' =>
'dolibarr_main_db_character_set',
'valifempty' =>
'utf8'),
149 'collation_database' => array(
'var' =>
'dolibarr_main_db_collation',
'valifempty' =>
'utf8_unicode_ci')
153 $listtouse = array();
154 if ($listname ==
'listofvars') {
155 $listtouse = $listofvars;
157 if ($listname ==
'listofstatus') {
158 $listtouse = $listofstatus;
161 foreach ($listtouse as $param => $paramval) {
162 print
'<tr class="oddeven">';
166 print
'<td class="wordbreak">';
169 foreach ($arraytest as $key => $val) {
170 if ($key != $param) {
173 $tmpvar = $val[
'var'];
175 $text =
'Should be in line with value of param <b>'.$val[
'var'].
'</b> thas is <b>'.($val2 ? $val2 :
"'' (=".$val[
'valifempty'].
")").
'</b>';
183 print $form->textwithpicto($paramval, $text);
187 print $form->textwithpicto($paramval, $text, 1,
'warning');
192 print
'</table>'.
"\n";
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dolPrintHTML($s, $allowiframe=0)
Return a string (that can be on several lines) ready to be output on a HTML page.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.