27 if (! defined(
'CSRFCHECK_WITH_TOKEN')) {
28 define(
'CSRFCHECK_WITH_TOKEN',
'1');
32 require
'../../main.inc.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
36 $langs->load(
"admin");
42 $action =
GETPOST(
'action',
'aZ09');
49 if ($action ==
'convert') {
50 $sql =
"ALTER TABLE ".$db->escape(
GETPOST(
"table",
"aZ09")).
" ENGINE=INNODB";
53 if ($action ==
'convertutf8') {
54 $sql =
"ALTER TABLE ".$db->escape(
GETPOST(
"table",
"aZ09")).
" CHARACTER SET utf8 COLLATE utf8_unicode_ci";
57 if ($action ==
'convertdynamic') {
58 $sql =
"ALTER TABLE ".$db->escape(
GETPOST(
"table",
"aZ09")).
" ROW_FORMAT=DYNAMIC;";
69 print
load_fiche_titre($langs->trans(
"Tables").
" ".ucfirst($conf->db->type),
'',
'title_setup');
74 if (preg_match(
'/mysql/i', $conf->db->type)) {
75 $sql =
"SHOW TABLE STATUS";
77 } elseif ($conf->db->type ==
'pgsql') {
78 $sql =
"SELECT conname, contype FROM pg_constraint;";
80 } elseif ($conf->db->type ==
'mssql') {
83 } elseif ($conf->db->type ==
'sqlite' || $conf->db->type ==
'sqlite3') {
90 print $langs->trans(
"FeatureNotAvailableWithThisDatabaseDriver");
93 print
'<div class="div-table-responsive-no-min">';
94 print
'<table class="noborder">';
95 print
'<tr class="liste_titre">';
97 print
'<td>'.$langs->trans(
"TableName").
'</td>';
98 print
'<td colspan="2">'.$langs->trans(
"Type").
'</td>';
99 print
'<td>'.$langs->trans(
"Format").
'</td>';
100 print
'<td class="right">'.$langs->trans(
"NbOfRecord").
'</td>';
101 print
'<td class="right">Avg_row_length</td>';
102 print
'<td class="right">Data_length</td>';
103 print
'<td class="right">Max_Data_length</td>';
104 print
'<td class="right">Index_length</td>';
105 print
'<td class="right">Increment</td>';
106 print
'<td class="right">Last check</td>';
107 print
'<td class="right">Collation</td>';
110 $arrayoffilesrich =
dol_dir_list(DOL_DOCUMENT_ROOT.
'/install/mysql/tables/',
'files', 0,
'\.sql$');
111 $arrayoffiles = array();
112 foreach ($arrayoffilesrich as $value) {
114 $shortsqlfilename = preg_replace(
'/\-[a-z]+\./',
'.', $value[
'name']);
115 $arrayoffiles[] = $shortsqlfilename;
118 $sql =
"SHOW TABLE STATUS";
120 $resql = $db->query($sql);
122 $num = $db->num_rows(
$resql);
125 $obj = $db->fetch_object(
$resql);
126 print
'<tr class="oddeven">';
128 print
'<td>'.($i+1).
'</td>';
129 print
'<td><a href="dbtable.php?table='.$obj->Name.
'">'.$obj->Name.
'</a>';
130 $tablename = preg_replace(
'/^'.MAIN_DB_PREFIX.
'/',
'llx_', $obj->Name);
132 if (in_array($tablename.
'.sql', $arrayoffiles)) {
138 print
img_picto($langs->trans(
"ExternalModule"), $img,
'class="small"');
141 print
'<td>'.$obj->Engine.
'</td>';
142 if (isset($obj->Engine) && $obj->Engine ==
"MyISAM") {
143 print
'<td><a class="reposition" href="database-tables.php?action=convert&table='.urlencode($obj->Name).
'&token='.
newToken().
'">'.$langs->trans(
"Convert").
' InnoDb</a></td>';
145 print
'<td> </td>';
148 print $obj->Row_format;
149 if (isset($obj->Row_format) && (in_array($obj->Row_format, array(
"Compact")))) {
150 print
'<br><a class="reposition" href="database-tables.php?action=convertdynamic&table='.urlencode($obj->Name).
'&token='.
newToken().
'">'.$langs->trans(
"Convert").
' Dynamic</a>';
153 print
'<td align="right">'.$obj->Rows.
'</td>';
154 print
'<td align="right">'.$obj->Avg_row_length.
'</td>';
155 print
'<td align="right">'.$obj->Data_length.
'</td>';
156 print
'<td align="right">'.$obj->Max_data_length.
'</td>';
157 print
'<td align="right">'.$obj->Index_length.
'</td>';
158 print
'<td align="right">'.$obj->Auto_increment.
'</td>';
159 print
'<td align="right">'.$obj->Check_time.
'</td>';
160 print
'<td align="right">'.$obj->Collation;
161 if (isset($obj->Collation) && (in_array($obj->Collation, array(
"utf8mb4_general_ci",
"utf8mb4_unicode_ci",
"latin1_swedish_ci")))) {
162 print
'<br><a class="reposition" href="database-tables.php?action=convertutf8&table='.urlencode($obj->Name).
'&token='.
newToken().
'">'.$langs->trans(
"Convert").
' UTF8</a>';
174 print
'<div class="div-table-responsive-no-min">';
175 print
'<table class="noborder">';
176 print
'<tr class="liste_titre">';
179 print
'<td>'.$langs->trans(
"TableName").
'</td>';
180 print
'<td>Nb of tuples</td>';
181 print
'<td>Nb index fetcher.</td>';
182 print
'<td>Nb tuples insert</td>';
183 print
'<td>Nb tuples modify</td>';
184 print
'<td>Nb tuples delete</td>';
187 $sql =
"SELECT relname, seq_tup_read, idx_tup_fetch, n_tup_ins, n_tup_upd, n_tup_del";
188 $sql .=
" FROM pg_stat_user_tables";
190 $resql = $db->query($sql);
192 $num = $db->num_rows(
$resql);
195 $row = $db->fetch_row(
$resql);
196 print
'<tr class="oddeven">';
197 print
'<td>'.($i+1).
'</td>';
198 print
'<td>'.$row[0].
'</td>';
199 print
'<td class="right">'.$row[1].
'</td>';
200 print
'<td class="right">'.$row[2].
'</td>';
201 print
'<td class="right">'.$row[3].
'</td>';
202 print
'<td class="right">'.$row[4].
'</td>';
203 print
'<td class="right">'.$row[5].
'</td>';
214 print
'<div class="div-table-responsive-no-min">';
215 print
'<table class="noborder">';
216 print
'<tr class="liste_titre">';
218 print
'<td>'.$langs->trans(
"TableName").
'</td>';
219 print
'<td>'.$langs->trans(
"NbOfRecord").
'</td>';
222 $sql =
"SELECT name, type FROM sqlite_master where type='table' and name not like 'sqlite%' ORDER BY name";
223 $resql = $db->query($sql);
226 while ($row = $db->fetch_row(
$resql)) {
227 $rescount = $db->query(
"SELECT COUNT(*) FROM ".$row[0]);
229 $row_count = $db->fetch_row($rescount);
230 $count = $row_count[0];
235 print
'<tr class="oddeven">';
236 print
'<td>'.($i+1).
'</td>';
237 print
'<td>'.$row[0].
'</td>';
238 print
'<td>'.$count.
'</td>';
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
load_fiche_titre($titre, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
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.