29require
'../../main.inc.php';
45$action =
GETPOST(
'action',
'aZ09');
59if ($action ==
'convertutf8unicode') {
60 $sql =
"ALTER DATABASE ".$db->sanitize(
$db->database_name).
" CHARACTER SET utf8 COLLATE utf8_unicode_ci";
61 $logsql .= $sql.
'<br>';
62 $resultsql =
$db->query($sql);
64if ($action ==
'convertutf8mb4unicode') {
65 $sql =
"ALTER DATABASE ".$db->sanitize(
$db->database_name).
" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci";
66 $logsql .= $sql.
'<br>';
67 $resultsql =
$db->query($sql);
69if ($action ==
'convertutf8general') {
70 $sql =
"ALTER DATABASE ".$db->sanitize(
$db->database_name).
" CHARACTER SET utf8 COLLATE utf8_general_ci";
71 $logsql .= $sql.
'<br>';
72 $resultsql =
$db->query($sql);
74if ($action ==
'convertutf8mb4general') {
75 $sql =
"ALTER DATABASE ".$db->sanitize(
$db->database_name).
" CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci";
76 $logsql .= $sql.
'<br>';
77 $resultsql =
$db->query($sql);
87llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-system_database');
92 print
info_admin($logsql.
' '.(empty($resultsql) ?
' => KO '.
$db->lasterror() :
' => OK'));
96print
'<div class="div-table-responsive-no-min">';
97print
'<table class="noborder centpercent">';
98print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Database").
'</td></tr>'.
"\n";
99print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"Version").
'</td><td>'.$db::LABEL.
' '.
$db->getVersion().
'</td></tr>'.
"\n";
100print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DatabaseServer").
'</td><td>'.
$conf->db->host.
'</td></tr>'.
"\n";
101print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DatabasePort").
'</td><td>'.(empty(
$conf->db->port) ? $langs->trans(
"Default") :
$conf->db->port).
'</td></tr>'.
"\n";
102print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DatabaseName").
'</td><td>'.
$conf->db->name.
'</td></tr>'.
"\n";
103print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DriverType").
'</td><td>'.
$conf->db->type.($db->getDriverInfo() ?
' ('.$db->getDriverInfo().
')' :
'').
'</td></tr>'.
"\n";
105print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"User").
'</td><td>'.
$conf->db->user.
'</td></tr>'.
"\n";
106print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"Password").
'</td><td>'.preg_replace(
'/./i',
'*', $dolibarr_main_db_pass).
'</td></tr>'.
"\n";
107print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DBStoringCharset").
'</td><td>'.
$db->getDefaultCharacterSetDatabase();
108if (
$db->type ==
'mysqli') {
109 $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).
"'";
110 print
' '.$form->textwithpicto(
'', $langs->transnoentitiesnoconv(
"HelpMariaDBToGetValue", $tooltipexample.
'<br>'.$langs->transnoentitiesnoconv(
"HelpMariaDBToGetPossibleValues",
"<br>SHOW CHARSET").
"<br><br>Example to change value: ALTER DATABASE ".
$conf->db->name.
" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"), 1,
'help',
'valignmiddle', 0, 3,
'tooltipcharset');
113print
'</td></tr>'.
"\n";
114print
'<tr class="oddeven"><td width="300">'.$langs->trans(
"DBSortingCharset").
'</td><td>';
115$defaultcollation =
$db->getDefaultCollationDatabase();
117global $dolibarr_main_db_collation;
118if (
$db->type ==
'mysqli') {
119 if ($defaultcollation !=
$conf->db->dolibarr_main_db_collation) {
120 print
img_warning(
'The database default value of collation '.$defaultcollation.
' differs from conf setup '.
$conf->db->dolibarr_main_db_collation);
122 $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).
"'";
123 print
' '.$form->textwithpicto(
'', $langs->transnoentitiesnoconv(
"HelpMariaDBToGetValue", $tooltipexample.
'<br>'.$langs->transnoentitiesnoconv(
"HelpMariaDBToGetPossibleValues",
"<br>SHOW COLLATION").
"<br><br>Example to change value: ALTER DATABASE ".
$conf->db->name.
" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"), 1,
'help',
'valignmiddle', 0, 3,
'tooltipcollation');
126 print
' <span class="opacitymedium small">'.$langs->trans(
"ConvertInto");
127 if (!in_array($defaultcollation, array(
"utf8_unicode_ci"))) {
128 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8unicode&token='.newToken().
'">utf8 unicode</a>';
130 if (!in_array($defaultcollation, array(
"utf8_general_ci"))) {
131 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8general&token='.newToken().
'">utf8 general</a>';
133 if (!in_array($defaultcollation, array(
"utf8mb4_unicode_ci"))) {
134 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8mb4unicode&&token='.newToken().
'">utf8mb4 unicode</a>';
136 if (!in_array($defaultcollation, array(
"utf8mb4_general_ci"))) {
137 print
' <a class="reposition" href="'.DOL_URL_ROOT.
'/admin/system/database.php?action=convertutf8mb4general&&token='.newToken().
'">utf8mb4 general</a>';
140print
'</td></tr>'.
"\n";
146print
'<div class="div-table-responsive-no-min">';
147print
'<table class="noborder centpercent">';
148print
'<tr class="liste_titre"><td colspan="2">'.$langs->trans(
"Tables").
'</td></tr>'.
"\n";
149print
'<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";
153$listofvars =
$db->getServerParametersValues();
154$listofstatus =
$db->getServerStatusValues();
155$arraylist = array(
'listofvars',
'listofstatus');
157if (!count($listofvars) && !count($listofstatus)) {
158 print $langs->trans(
"FeatureNotAvailableWithThisDatabaseDriver");
160 foreach ($arraylist as $listname) {
162 print
'<div class="div-table-responsive-no-min">';
163 print
'<table class="noborder centpercent">';
164 print
'<tr class="liste_titre">';
165 print
'<td width="300">'.$langs->trans(
"Parameters").
'</td>';
170 $arraytest = array();
171 if (preg_match(
'/mysql/i',
$db->type)) {
173 'character_set_database' => array(
'var' =>
'dolibarr_main_db_character_set',
'valifempty' =>
'utf8'),
174 'collation_database' => array(
'var' =>
'dolibarr_main_db_collation',
'valifempty' =>
'utf8_unicode_ci')
178 $listtouse = array();
179 if ($listname ==
'listofvars') {
180 $listtouse = $listofvars;
182 if ($listname ==
'listofstatus') {
183 $listtouse = $listofstatus;
186 foreach ($listtouse as $param => $paramval) {
187 print
'<tr class="oddeven">';
191 print
'<td class="wordbreak">';
194 foreach ($arraytest as $key => $val) {
195 if ($key != $param) {
198 $tmpvar = $val[
'var'];
200 $text =
'Should be in line with value of param <b>'.$val[
'var'].
'</b> thas is <b>'.($val2 ? $val2 :
"'' (=".$val[
'valifempty'].
")").
'</b>';
208 print $form->textwithpicto($paramval, $text);
212 print $form->textwithpicto($paramval, $text, 1,
'warning');
217 print
'</table>'.
"\n";
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
img_warning($titlealt='default', $moreatt='', $morecss='pictowarning')
Show warning logo.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
dolPrintHTML($s, $allowiframe=0, $moreallowedtags=array())
Return a string (that can be on several lines) ready to be output on a HTML page.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.