fixed inactivity timeout failure
[openemr.git] / interface / main / myadmin / db_details_db_info.php
blobac150773ee7deefd3a7f4f5bbba6768d6bd2ce6b
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
6 // Check parameters
8 require_once('./libraries/common.lib.php');
10 PMA_checkParameters(array('db'));
13 /**
14 * Gets the list of the table in the current db and informations about these
15 * tables if possible
17 // staybyte: speedup view on locked tables - 11 June 2001
18 $tables = array();
19 // Special speedup for newer MySQL Versions (in 4.0 format changed)
20 if ($cfg['SkipLockedTables'] == TRUE) {
21 $local_query = 'SHOW OPEN TABLES FROM ' . PMA_backquote($db);
22 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
23 // Blending out tables in use
24 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
25 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
26 // if in use memorize tablename
27 if (preg_match('@in_use=[1-9]+@i', $tmp[1])) {
28 $sot_cache[$tmp[0]] = TRUE;
31 mysql_free_result($db_info_result);
33 if (isset($sot_cache)) {
34 $local_query = 'SHOW TABLES FROM ' . PMA_backquote($db);
35 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
36 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
37 while ($tmp = PMA_mysql_fetch_row($db_info_result)) {
38 if (!isset($sot_cache[$tmp[0]])) {
39 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db) . ' LIKE \'' . addslashes($tmp[0]) . '\'';
40 $sts_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
41 $sts_tmp = PMA_mysql_fetch_array($sts_result);
42 $tables[] = $sts_tmp;
43 } else { // table in use
44 $tables[] = array('Name' => $tmp[0]);
47 mysql_free_result($db_info_result);
48 $sot_ready = TRUE;
53 if (!isset($sot_ready)) {
54 $local_query = 'SHOW TABLE STATUS FROM ' . PMA_backquote($db);
55 $db_info_result = PMA_mysql_query($local_query) or PMA_mysqlDie('', $local_query, '', $err_url_0);
56 if ($db_info_result != FALSE && mysql_num_rows($db_info_result) > 0) {
57 while ($sts_tmp = PMA_mysql_fetch_array($db_info_result)) {
58 $tables[] = $sts_tmp;
60 mysql_free_result($db_info_result);
63 $num_tables = (isset($tables) ? count($tables) : 0);
65 /**
66 * Displays top menu links
68 echo '<!-- Top menu links -->' . "\n";
69 require('./db_details_links.php');