Documentation TYPO3 par Ameos

db_printview.php

00001 <?php
00002 /* $Id: db_printview.php,v 2.10 2005/05/22 17:09:27 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00009 require_once('./libraries/grab_globals.lib.php');
00010 $print_view = TRUE;
00011 require_once('./header.inc.php');
00012 
00013 // Check parameters
00014 require_once('./libraries/common.lib.php');
00015 
00016 PMA_checkParameters(array('db'));
00017 
00021 $err_url = 'db_details.php?' . PMA_generate_common_url($db);
00022 
00026 require_once('./libraries/relation.lib.php');
00027 $cfgRelation = PMA_getRelationsParam();
00028 
00033 // staybyte: speedup view on locked tables - 11 June 2001
00034 // Special speedup for newer MySQL Versions (in 4.0 format changed)
00035 if ($cfg['SkipLockedTables'] == TRUE) {
00036     $result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
00037     // Blending out tables in use
00038     if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
00039         while ($tmp = PMA_DBI_fetch_row($result)) {
00040             // if in use memorize tablename
00041             if (preg_match('@in_use=[1-9]+@i', $tmp[0])) {
00042                 $sot_cache[$tmp[0]] = TRUE;
00043             }
00044         }
00045         PMA_DBI_free_result($result);
00046         unset($result);
00047 
00048         if (isset($sot_cache)) {
00049             $result      = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
00050             if ($result != FALSE && PMA_DBI_num_rows($result) > 0) {
00051                 while ($tmp = PMA_DBI_fetch_row($result)) {
00052                     if (!isset($sot_cache[$tmp[0]])) {
00053                         $sts_result  = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
00054                         $sts_tmp     = PMA_DBI_fetch_assoc($sts_result);
00055                         $tables[]    = $sts_tmp;
00056                     } else { // table in use
00057                         $tables[]    = array('Name' => $tmp[0]);
00058                     }
00059                 }
00060                 PMA_DBI_free_result($result);
00061                 unset($result);
00062                 $sot_ready = TRUE;
00063             }
00064         }
00065     }
00066 }
00067 if (!isset($sot_ready)) {
00068     $result      = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ';');
00069     if (PMA_DBI_num_rows($result) > 0) {
00070         while ($sts_tmp = PMA_DBI_fetch_assoc($result)) {
00071             $tables[] = $sts_tmp;
00072         }
00073         PMA_DBI_free_result($result);
00074         unset($res);
00075     }
00076 }
00077 $num_tables = (isset($tables) ? count($tables) : 0);
00078 
00079 if ($cfgRelation['commwork']) {
00080     $comment = PMA_getComments($db);
00081 
00085     if (is_array($comment)) {
00086         ?>
00087     <!-- DB comment -->
00088     <p><i>
00089         <?php echo htmlspecialchars(implode(' ', $comment)) . "\n"; ?>
00090     </i></p>
00091         <?php
00092     } // end if
00093 }
00094 
00099 // 1. No table
00100 if ($num_tables == 0) {
00101     echo $strNoTablesFound;
00102 }
00103 // 2. Shows table informations on mysql >= 3.23.03 - staybyte - 11 June 2001
00104 else {
00105     ?>
00106 
00107 <!-- The tables list -->
00108 <table border="<?php echo $cfg['Border']; ?>">
00109 <tr>
00110     <th>&nbsp;<?php echo $strTable; ?>&nbsp;</th>
00111     <th><?php echo $strRecords; ?></th>
00112     <th><?php echo $strType; ?></th>
00113     <?php
00114     if ($cfg['ShowStats']) {
00115         echo '<th>' . $strSize . '</th>';
00116     }
00117     echo "\n";
00118     ?>
00119     <th><?php echo $strComments; ?></th>
00120 </tr>
00121     <?php
00122     $i = $sum_entries = $sum_size = 0;
00123     foreach ($tables AS $keyname => $sts_data) {
00124         $table     = $sts_data['Name'];
00125         $bgcolor   = ($i++ % 2) ? $cfg['BgcolorOne'] : $cfg['BgcolorTwo'];
00126         echo "\n";
00127         ?>
00128 <tr>
00129     <td bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00130         &nbsp;<b><?php echo htmlspecialchars($table); ?>&nbsp;</b>&nbsp;
00131     </td>
00132         <?php
00133         echo "\n";
00134         $mergetable         = FALSE;
00135         $nonisam            = FALSE;
00136         if (isset($sts_data['Type'])) {
00137             if ($sts_data['Type'] == 'MRG_MyISAM') {
00138                 $mergetable = TRUE;
00139             } else if (!preg_match('@ISAM|HEAP@i', $sts_data['Type'])) {
00140                 $nonisam    = TRUE;
00141             }
00142         }
00143 
00144         if (isset($sts_data['Rows'])) {
00145             if ($mergetable == FALSE) {
00146                 if ($cfg['ShowStats'] && $nonisam == FALSE) {
00147                     $tblsize                        =  $sts_data['Data_length'] + $sts_data['Index_length'];
00148                     $sum_size                       += $tblsize;
00149                     if ($tblsize > 0) {
00150                         list($formated_size, $unit) =  PMA_formatByteDown($tblsize, 3, 1);
00151                     } else {
00152                         list($formated_size, $unit) =  PMA_formatByteDown($tblsize, 3, 0);
00153                     }
00154                 } else if ($cfg['ShowStats']) {
00155                     $formated_size                  = '&nbsp;-&nbsp;';
00156                     $unit                           = '';
00157                 }
00158                 $sum_entries                        += $sts_data['Rows'];
00159             }
00160             // MyISAM MERGE Table
00161             else if ($cfg['ShowStats'] && $mergetable == TRUE) {
00162                 $formated_size = '&nbsp;-&nbsp;';
00163                 $unit          = '';
00164             }
00165             else if ($cfg['ShowStats']) {
00166                 $formated_size = 'unknown';
00167                 $unit          = '';
00168             }
00169             ?>
00170     <td align="right" bgcolor="<?php echo $bgcolor; ?>">
00171             <?php
00172             echo "\n" . '        ';
00173             if ($mergetable == TRUE) {
00174                 echo '<i>' . number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . '</i>' . "\n";
00175             } else {
00176                 echo number_format($sts_data['Rows'], 0, $number_decimal_separator, $number_thousands_separator) . "\n";
00177             }
00178             ?>
00179     </td>
00180     <td nowrap="nowrap" bgcolor="<?php echo $bgcolor; ?>">
00181         &nbsp;<?php echo (isset($sts_data['Type']) ? $sts_data['Type'] : '&nbsp;'); ?>&nbsp;
00182     </td>
00183             <?php
00184             if ($cfg['ShowStats']) {
00185                 echo "\n";
00186                 ?>
00187     <td align="right" bgcolor="<?php echo $bgcolor; ?>" nowrap="nowrap">
00188         &nbsp;<?php echo $formated_size . ' ' . $unit . "\n"; ?>
00189     </td>
00190                 <?php
00191                 echo "\n";
00192             } // end if
00193         } else {
00194             ?>
00195     <td colspan="3" align="center" bgcolor="<?php echo $bgcolor; ?>">
00196         <?php echo $strInUse . "\n"; ?>
00197     </td>
00198             <?php
00199         }
00200         echo "\n";
00201         ?>
00202     <td bgcolor="<?php echo $bgcolor; ?>">
00203         <?php echo $sts_data['Comment']; ?>
00204         <?php
00205             if (!empty($sts_data['Comment'])) {
00206                 $needs_break = '<br />';
00207             } else {
00208                 $needs_break = '';
00209             }
00210 
00211             if ((isset($sts_data['Create_time']) && !empty($sts_data['Create_time']))
00212                  || (isset($sts_data['Update_time']) && !empty($sts_data['Update_time']))
00213                  || (isset($sts_data['Check_time']) && !empty($sts_data['Check_time']))) {
00214                 echo $needs_break;
00215                 ?>
00216                 <table border="0" cellpadding="1" cellspacing="1" width="100%" class="noborder">
00217                 <?php
00218 
00219                 if (isset($sts_data['Create_time']) && !empty($sts_data['Create_time'])) {
00220                     ?>
00221                     <tr>
00222                         <td style="font-size: <?php echo $font_smaller; ?>" align="right"><?php echo $strStatCreateTime . ': '; ?></td>
00223                         <td style="font-size: <?php echo $font_smaller; ?>" align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Create_time'])); ?></td>
00224                     </tr>
00225                     <?php
00226                 }
00227 
00228                 if (isset($sts_data['Update_time']) && !empty($sts_data['Update_time'])) {
00229                     ?>
00230                     <tr>
00231                         <td style="font-size: <?php echo $font_smaller; ?>" align="right"><?php echo $strStatUpdateTime . ': '; ?></td>
00232                         <td style="font-size: <?php echo $font_smaller; ?>" align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Update_time'])); ?></td>
00233                     </tr>
00234                     <?php
00235                 }
00236 
00237                 if (isset($sts_data['Check_time']) && !empty($sts_data['Check_time'])) {
00238                     ?>
00239                     <tr>
00240                         <td style="font-size: <?php echo $font_smaller; ?>" align="right"><?php echo $strStatCheckTime . ': '; ?></td>
00241                         <td style="font-size: <?php echo $font_smaller; ?>" align="right"><?php echo PMA_localisedDate(strtotime($sts_data['Check_time'])); ?></td>
00242                     </tr>
00243                     <?php
00244                 }
00245                 ?>
00246                 </table>
00247                 <?php
00248             }
00249         ?>
00250     </td>
00251 </tr>
00252         <?php
00253     }
00254     // Show Summary
00255     if ($cfg['ShowStats']) {
00256         list($sum_formated, $unit) = PMA_formatByteDown($sum_size, 3, 1);
00257     }
00258     echo "\n";
00259     ?>
00260 <tr>
00261     <th align="center">
00262         &nbsp;<b><?php echo sprintf($strTables, number_format($num_tables, 0, $number_decimal_separator, $number_thousands_separator)); ?></b>&nbsp;
00263     </th>
00264     <th align="right" nowrap="nowrap">
00265         <b><?php echo number_format($sum_entries, 0, $number_decimal_separator, $number_thousands_separator); ?></b>
00266     </th>
00267     <th align="center">
00268         <b>--</b>
00269     </th>
00270     <?php
00271     if ($cfg['ShowStats']) {
00272         echo "\n";
00273         ?>
00274     <th align="right" nowrap="nowrap">
00275         <b><?php echo $sum_formated . ' ' . $unit; ?></b>
00276     </th>
00277         <?php
00278     }
00279     echo "\n";
00280     ?>
00281     <th>&nbsp;</th>
00282 </tr>
00283 </table>
00284     <?php
00285 }
00286 
00290 echo "\n";
00291 ?>
00292 <script type="text/javascript" language="javascript1.2">
00293 <!--
00294 function printPage()
00295 {
00296     // Do print the page
00297     if (typeof(window.print) != 'undefined') {
00298         window.print();
00299     }
00300 }
00301 //-->
00302 </script>
00303 <?php
00304 echo '<br /><br />&nbsp;<input type="button" class="print_ignore" style="width: 100px; height: 25px" id="print" value="' . $strPrint . '" onclick="printPage()" />' . "\n";
00305 
00306 require_once('./footer.inc.php');
00307 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6