Documentation TYPO3 par Ameos

db_details_db_info.php

00001 <?php
00002 /* $Id: db_details_db_info.php,v 2.10 2004/07/13 16:17:32 rabus Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00006 // Check parameters
00007 
00008 require_once('./libraries/common.lib.php');
00009 
00010 PMA_checkParameters(array('db'));
00011 
00012 function fillTooltip(&$tooltip_truename, &$tooltip_aliasname, &$tmp) {
00013     $tooltip_truename[$tmp['Name']] = ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested' ? (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']) : $tmp['Name']);
00014     $tooltip_aliasname[$tmp['Name']] = ($GLOBALS['cfg']['ShowTooltipAliasTB'] && $GLOBALS['cfg']['ShowTooltipAliasTB'] != 'nested'  ? $tmp['Name'] : (!empty($tmp['Comment']) ? $tmp['Comment'] . ' ' : $tmp['Name']));
00015     if (isset($tmp['Create_time']) && !empty($tmp['Create_time'])) {
00016         $tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCreateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Create_time']));
00017     }
00018 
00019     if (isset($tmp['Update_time']) && !empty($tmp['Update_time'])) {
00020         $tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatUpdateTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Update_time']));
00021     }
00022 
00023     if (isset($tmp['Check_time']) && !empty($tmp['Check_time'])) {
00024         $tooltip_aliasname[$tmp['Name']] .= ', ' . $GLOBALS['strStatCheckTime'] . ': ' . PMA_localisedDate(strtotime($tmp['Check_time']));
00025     }
00026 
00027     return true;
00028 }
00029 
00034 // staybyte: speedup view on locked tables - 11 June 2001
00035 $tables = array();
00036 
00037 // When used in Nested table group mode, only show tables matching the given groupname
00038 if (!empty($tbl_group) && !$cfg['ShowTooltipAliasTB']) {
00039     $tbl_group_sql = ' LIKE \'' . $tbl_group . '%\'';
00040 } else {
00041     $tbl_group_sql = '';
00042 }
00043 
00044 if ($cfg['ShowTooltip']) {
00045     $tooltip_truename = array();
00046     $tooltip_aliasname = array();
00047 }
00048 
00049 // Special speedup for newer MySQL Versions (in 4.0 format changed)
00050 if ($cfg['SkipLockedTables'] == TRUE) {
00051     $db_info_result = PMA_DBI_query('SHOW OPEN TABLES FROM ' . PMA_backquote($db) . ';');
00052     // Blending out tables in use
00053     if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
00054         while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
00055             // if in use memorize tablename
00056             if (preg_match('@in_use=[1-9]+@i', $tmp[1])) {
00057                 $sot_cache[$tmp[0]] = TRUE;
00058             }
00059         }
00060         PMA_DBI_free_result($db_info_result);
00061 
00062         if (isset($sot_cache)) {
00063             $db_info_result = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
00064             if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
00065                 while ($tmp = PMA_DBI_fetch_row($db_info_result)) {
00066                     if (!isset($sot_cache[$tmp[0]])) {
00067                         $sts_result  = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\';');
00068                         $sts_tmp     = PMA_DBI_fetch_assoc($sts_result);
00069                         PMA_DBI_free_result($sts_result);
00070                         unset($sts_result);
00071 
00072                         if (!isset($sts_tmp['Type']) && isset($sts_tmp['Engine'])) {
00073                             $sts_tmp['Type'] =& $sts_tmp['Engine'];
00074                         }
00075 
00076                         if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
00077                             continue;
00078                         }
00079 
00080                         if ($cfg['ShowTooltip']) {
00081                             fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
00082                         }
00083 
00084                         $tables[]    = $sts_tmp;
00085                     } else { // table in use
00086                         $tables[]    = array('Name' => $tmp[0]);
00087                     }
00088                 }
00089                 PMA_DBI_free_result($db_info_result);
00090                 $sot_ready = TRUE;
00091             }
00092         }
00093     } else {
00094         PMA_DBI_free_result($db_info_result);
00095         unset($db_info_result);
00096     }
00097 }
00098 if (!isset($sot_ready)) {
00099     $db_info_result = PMA_DBI_query('SHOW TABLE STATUS FROM ' . PMA_backquote($db) . $tbl_group_sql . ';', NULL, PMA_DBI_QUERY_STORE);
00100     if ($db_info_result != FALSE && PMA_DBI_num_rows($db_info_result) > 0) {
00101         while ($sts_tmp = PMA_DBI_fetch_assoc($db_info_result)) {
00102             if (!isset($sts_tmp['Type']) && isset($sts_tmp['Engine'])) {
00103                 $sts_tmp['Type'] =& $sts_tmp['Engine'];
00104             }
00105             if (!empty($tbl_group) && $cfg['ShowTooltipAliasTB'] && !preg_match('@' . preg_quote($tbl_group, '@') . '@i', $sts_tmp['Comment'])) {
00106                 continue;
00107             }
00108 
00109             if ($cfg['ShowTooltip']) {
00110                 fillTooltip($tooltip_truename, $tooltip_aliasname, $sts_tmp);
00111             }
00112 
00113             $tables[] = $sts_tmp;
00114         }
00115     }
00116     @PMA_DBI_free_result($db_info_result);
00117     unset($db_info_result);
00118 }
00119 $num_tables = (isset($tables) ? count($tables) : 0);
00120 
00124 echo '<!-- Top menu links -->' . "\n";
00125 require('./db_details_links.php');
00126 
00127 ?>


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