[ Index ]
 

Code source de Dolibarr 2.0.1

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/htdocs/admin/system/ -> database-tables.php (source)

   1  <?php
   2  /* Copyright (C) 2003      Rodolphe Quiedeville <rodolphe@quiedeville.org>
   3   * Copyright (C) 2004-2005 Laurent Destailleur  <eldy@users.sourceforge.net>
   4   * Copyright (C) 2004      Sebastien Di Cintio  <sdicintio@ressource-toi.org>
   5   * Copyright (C) 2004      Benoit Mortier       <benoit.mortier@opensides.be>
   6   *
   7   * This program is free software; you can redistribute it and/or modify
   8   * it under the terms of the GNU General Public License as published by
   9   * the Free Software Foundation; either version 2 of the License, or
  10   * (at your option) any later version.
  11   *
  12   * This program is distributed in the hope that it will be useful,
  13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15   * GNU General Public License for more details.
  16   *
  17   * You should have received a copy of the GNU General Public License
  18   * along with this program; if not, write to the Free Software
  19   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20   *
  21   * $Id: database-tables.php,v 1.5 2005/07/08 20:51:20 eldy Exp $
  22   * $Source: /cvsroot/dolibarr/dolibarr/htdocs/admin/system/database-tables.php,v $
  23   */
  24  
  25  /**    
  26          \file       htdocs/admin/system/database-tables.php
  27          \brief      Page d'infos des tables de la base
  28          \version    $Revision: 1.5 $
  29  */
  30  
  31  require ("./pre.inc.php");
  32  include_once $dolibarr_main_document_root."/lib/".$conf->db->type.".lib.php";
  33  
  34  $langs->load("admin");
  35  
  36  if (!$user->admin)
  37    accessforbidden();
  38  
  39      
  40  
  41  if ($_GET["action"] == 'convert')
  42  {
  43    $db->query("alter table ".$_GET["table"]." type=INNODB");
  44  }
  45  
  46  llxHeader();
  47  
  48  
  49  print_titre($langs->trans("Tables")." ".ucfirst($conf->db->type));
  50  
  51  if($conf->db->type == 'mysql')
  52  {
  53      print '<br>';
  54      print '<table class="noborder">';
  55      print '<tr class="liste_titre">';
  56      print '<td>'.$langs->trans("TableName").'</td>';
  57      print '<td colspan="2">'.$langs->trans("Type").'</td>';
  58      print '<td>'.$langs->trans("Format").'</td>';
  59      print '<td>'.$langs->trans("NbOfRecord").'</td>';
  60      print '<td>Avg_row_length</td>';
  61      print '<td>Data_length</td>';
  62      print '<td>Max_Data_length</td>';
  63      print '<td>Index_length</td>';
  64      print '<td>Increment</td>';
  65      print '<td>Last check</td>';
  66      print "</tr>\n";
  67      
  68      $sql = "SHOW TABLE STATUS";
  69      
  70      $result = $db->query($sql);
  71      if ($result) 
  72      {
  73        $num = $db->num_rows($result);
  74        $var=True;
  75        $i=0;
  76        while ($i < $num)
  77          {
  78            $obj = $db->fetch_object($result);
  79            $var=!$var;
  80            print "<tr $bc[$var]>";
  81      
  82            print '<td>'.$obj->Name.'</td>';
  83            print '<td>'.$obj->Engine.'</td>';
  84            if ($row[1] == "MyISAM")
  85          {
  86            print '<td><a href="database-tables.php?action=convert&amp;table='.$row[0].'">'.$langs->trans("Convert").'</a></td>';
  87          }
  88            else
  89          {
  90            print '<td>&nbsp;</td>';
  91          }
  92            print '<td>'.$obj->Row_format.'</td>';
  93            print '<td align="right">'.$obj->Rows.'</td>';
  94            print '<td align="right">'.$obj->Avg_row_length.'</td>';
  95            print '<td align="right">'.$obj->Data_length.'</td>';
  96            print '<td align="right">'.$obj->Max_data_length.'</td>';
  97            print '<td align="right">'.$obj->Index_length.'</td>';
  98            print '<td align="right">'.$obj->Auto_increment.'</td>';
  99            print '<td align="right">'.$obj->Check_time.'</td>';
 100            print '</tr>';
 101            $i++;
 102          }
 103      }
 104      print '</table>';
 105  }
 106  
 107  if($conf->db->type == 'pgsql')
 108  {
 109      print '<br>';
 110      print '<table class="noborder">';
 111      print '<tr class="liste_titre">';
 112      print '<td>'.$langs->trans("TableName").'</td>';
 113      print '<td>Nombre de tuples lu</td>';
 114      print '<td>Nb index fetcher.</td>';
 115      print '<td>Nbre de tuples inserer</td>';
 116      print '<td>Nbre de tuple modifier</td>';
 117      print '<td>Nbre de tuple supprimer</td>';
 118      print "</tr>\n";
 119      $sql = "select relname,seq_tup_read,idx_tup_fetch,n_tup_ins,n_tup_upd,n_tup_del from pg_stat_user_tables;";
 120                      
 121      $result = $db->query($sql);
 122      if ($result) 
 123      {
 124        $num = $db->num_rows();
 125        $var=True;
 126        $i=0;
 127        while ($i < $num)
 128          {
 129              $row = $db->fetch_row($i);
 130              $var=!$var;
 131              print "<tr $bc[$var]>";
 132              print '<td align="right">'.$row[0].'</td>';
 133              print '<td align="right">'.$row[1].'</td>';
 134              print '<td align="right">'.$row[2].'</td>';
 135              print '<td align="right">'.$row[3].'</td>';
 136              print '<td align="right">'.$row[4].'</td>';
 137              print '<td align="right">'.$row[5].'</td>';
 138              print '</tr>';
 139              $i++;
 140              }
 141      }
 142      print '</table>';
 143  }
 144  
 145  
 146  llxFooter('$Date: 2005/07/08 20:51:20 $ - $Revision: 1.5 $');
 147  
 148  ?>


Généré le : Mon Nov 26 12:29:37 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics