small new feature: stats overview about all databases of a server
This commit is contained in:
@@ -5,6 +5,11 @@ phpMyAdmin - Changelog
|
||||
$Id$
|
||||
$Source$
|
||||
|
||||
2001-08-20 Olivier M<>ller <om@omnis.ch>
|
||||
* db_stats.php3: new file and feature (sorry :) : simply display
|
||||
an overview of all databases with their respective size.
|
||||
* lang/*: new string $strDatabasesStats
|
||||
|
||||
2001-08-20 Marc Delisle <lem9@users.sourceforge.net>
|
||||
* config.inc.php3: $cfgProtectBlob is now TRUE by default, to help against
|
||||
the blob data corruption of some browsers.
|
||||
|
153
db_stats.php3
Normal file
153
db_stats.php3
Normal file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* Gets the variables sent to this script, retains the db name that may have
|
||||
* been defined as startup option and include a core library
|
||||
*/
|
||||
require('./grab_globals.inc.php3');
|
||||
if (!empty($db)) {
|
||||
$db_start = $db;
|
||||
}
|
||||
require('./lib.inc.php3');
|
||||
include('./header.inc.php3');
|
||||
|
||||
|
||||
/**
|
||||
* Get the list and number of available databases.
|
||||
* Skipped if no server selected: in this case no database should be displayed
|
||||
* before the user choose among available ones at the welcome screen.
|
||||
*/
|
||||
if ($server > 0) {
|
||||
// Get the valid databases list
|
||||
$num_dbs = count($dblist);
|
||||
$dbs = @mysql_list_dbs() or mysql_die();
|
||||
while ($a_db = mysql_fetch_object($dbs)) {
|
||||
if (!$num_dbs) {
|
||||
$dblist[] = $a_db->Database;
|
||||
} else {
|
||||
$true_dblist[$a_db->Database] = '';
|
||||
}
|
||||
}
|
||||
if ($num_dbs && empty($true_dblist)) {
|
||||
$dblist = array();
|
||||
} else if ($num_dbs) {
|
||||
for ($i = 0; $i < $num_dbs; $i++) {
|
||||
if (isset($true_dblist[$dblist[$i]])) {
|
||||
$dblist_valid[] = $dblist[$i];
|
||||
}
|
||||
}
|
||||
if (isset($dblist_valid)) {
|
||||
$dblist = $dblist_valid;
|
||||
unset($dblist_valid);
|
||||
} else {
|
||||
$dblist = array();
|
||||
}
|
||||
unset($true_dblist);
|
||||
}
|
||||
// Get the valid databases count
|
||||
$num_dbs = count($dblist);
|
||||
} else {
|
||||
$num_dbs = 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send http headers
|
||||
*/
|
||||
// Don't use cache (required for Opera)
|
||||
$now = gmdate('D, d M Y H:i:s') . ' GMT';
|
||||
header('Expires: ' . $now);
|
||||
header('Last-Modified: ' . $now);
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
|
||||
header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
|
||||
header('Pragma: no-cache'); // HTTP/1.0
|
||||
// Define the charset to be used
|
||||
header('Content-Type: text/html; charset=' . $charset);
|
||||
|
||||
|
||||
/**
|
||||
* Displays the frame
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>phpMyAdmin</title>
|
||||
<base target="phpmain" />
|
||||
</head>
|
||||
|
||||
<body bgcolor="#D0DCE0">
|
||||
|
||||
<h1><?php echo ucfirst($strDatabasesStats); ?> -
|
||||
<?php echo ($strHost . ': ' . $cfgServer['host']); ?>
|
||||
</h1>
|
||||
<h2><?php echo ($strGenTime . ': ' . date('F j, Y, g:i a')); ?></h2>
|
||||
|
||||
<!-- Databases and tables list -->
|
||||
|
||||
<table border="<?php echo $cfgBorder; ?>">
|
||||
<tr>
|
||||
<th><?php echo ucfirst($strDatabase); ?></th>
|
||||
<th><?php echo ucfirst($strData); ?></th>
|
||||
<th><?php echo ucfirst($strIndexes); ?></th>
|
||||
<th><?php echo ucfirst($strTotal); ?></th>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
if ($num_dbs > 1) {
|
||||
$selected_db = 0;
|
||||
|
||||
// Gets the tables list per database
|
||||
for ($i = 0; $i < $num_dbs; $i++) {
|
||||
$db = $dblist[$i];
|
||||
$j = $i + 2;
|
||||
$bgcolor = ($i % 2) ? $cfgBgcolorOne : $cfgBgcolorTwo;
|
||||
|
||||
if (!empty($db_start) && $db == $db_start) {
|
||||
$selected_db = $j;
|
||||
}
|
||||
$tables = @mysql_list_tables($db);
|
||||
$num_tables = @mysql_numrows($tables);
|
||||
$common_url_query = 'lang=' . $lang
|
||||
. '&server=' . urlencode($server)
|
||||
. '&db=' . urlencode($db);
|
||||
|
||||
// get size of data and indexes
|
||||
|
||||
$db_clean = backquote($db);
|
||||
$tot_data = 0; $tot_idx = 0; $tot_all = 0;
|
||||
$result = mysql_query("SHOW TABLE STATUS FROM $db_clean") or mysql_die();
|
||||
if (mysql_num_rows($result)) {
|
||||
while ($row = mysql_fetch_array($result)) {
|
||||
$tot_data += $row['Data_length'];
|
||||
$tot_idx += $row['Index_length'];
|
||||
}
|
||||
$tot_all = $tot_data + $tot_idx;
|
||||
}
|
||||
|
||||
list($tot_data_format,$unit_data) = format_byte_down($tot_data,3,1);
|
||||
list($tot_idx_format,$unit_idx) = format_byte_down($tot_idx,3,1);
|
||||
list($tot_all_format,$unit_all) = format_byte_down($tot_all,3,1);
|
||||
|
||||
echo "<tr bgcolor=\"$bgcolor\"><td>" . urlencode($db) . " </td>";
|
||||
echo "<td>$tot_data_format $unit_data </td>";
|
||||
echo "<td>$tot_idx_format $unit_idx </td>";
|
||||
echo "<td><b>$tot_all_format $unit_all<b> </td>";
|
||||
echo "</tr>";
|
||||
|
||||
}
|
||||
|
||||
echo "</table>";
|
||||
|
||||
} // end if ($num_dbs == 1)
|
||||
else {
|
||||
echo "\n";
|
||||
echo '<p>' . $strNoDatabases . '</p>';
|
||||
} // end if ($num_dbs == 0)
|
||||
echo "\n";
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -298,4 +298,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -298,4 +298,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -293,4 +293,5 @@ $strShowThisQuery = ' Show this query here again ';
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -294,4 +294,5 @@ $strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = ' Use backquotes with tables and fields names '; //to translate
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -298,4 +298,5 @@ $strShowThisQuery = ' Show this query here again ';
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -293,4 +293,5 @@ $strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -294,4 +294,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -293,4 +293,5 @@ $strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -298,4 +298,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -69,6 +69,7 @@ $strCriteria = 'Criteria';
|
||||
$strData = 'Data';
|
||||
$strDatabase = 'Database ';
|
||||
$strDatabases = 'databases';
|
||||
$strDatabasesStats = 'Databases statistics';
|
||||
$strDataOnly = 'Data only';
|
||||
$strDbEmpty = 'The database name is empty!';
|
||||
$strDefault = 'Default';
|
||||
|
@@ -69,6 +69,7 @@ $strCriteria = 'Crit
|
||||
$strData = 'Donn<6E>es';
|
||||
$strDatabase = 'Base de donn<6E>es';
|
||||
$strDatabases = 'bases de donn<6E>es';
|
||||
$strDatabasesStats = 'Statistiques sur les bases de donn<6E>es';
|
||||
$strDataOnly = 'Donn<6E>es seulement';
|
||||
$strDbEmpty = 'Le nom de la base de donn<6E>es est vide';
|
||||
$strDefault = 'D<>faut';
|
||||
|
@@ -69,6 +69,7 @@ $strCriteria = 'Kriterium';
|
||||
$strData = 'Daten';
|
||||
$strDatabase = 'Datenbank ';
|
||||
$strDatabases = 'Datenbanken';
|
||||
$strDatabasesStats = 'Statistiken <20>ber alle Datenbanken';
|
||||
$strDataOnly = 'Nur Daten';
|
||||
$strDbEmpty = 'Der Name der Datenbank ist leer!';
|
||||
$strDefault = 'Standard';
|
||||
@@ -291,6 +292,4 @@ $strWelcome = 'Willkommen bei ';
|
||||
$strWrongUser = 'Falscher Benutzername/Passwort. Zugriff verweigert.';
|
||||
|
||||
$strYes = 'Ja';
|
||||
|
||||
// To translate
|
||||
?>
|
||||
|
@@ -293,4 +293,5 @@ $strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -297,4 +297,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -297,4 +297,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -297,4 +297,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -292,4 +292,5 @@ $strLengthSet = 'Length/Values*';
|
||||
$strNoDatabases = 'No databases';
|
||||
$strSetEnumVal = 'If field type is "enum" or "set", please enter the values using this format: \'a\',\'b\',\'c\'...<br />If you ever need to put a backslash ("\") or a single quote ("\'") amongst those values, backslashes it (for example \'\\\\xyz\' or \'a\\\'b\').';
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -297,4 +297,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -293,4 +293,5 @@ $strSetEnumVal = 'If field type is "enum" or "set", please enter the values usin
|
||||
$strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -293,4 +293,5 @@ $strSetEnumVal = 'If field type is "enum" or "set", please enter the values usin
|
||||
$strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -294,4 +294,5 @@ $strSetEnumVal = 'If field type is "enum" or "set", please enter the values usin
|
||||
$strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -295,4 +295,5 @@ $strSetEnumVal = 'If field type is "enum" or "set", please enter the values usin
|
||||
$strShowPHPInfo = 'Show PHP information'; // To translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -298,4 +298,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -298,4 +298,5 @@ $strShowThisQuery = ' Show this query here again '; //to translate
|
||||
$strStrucExcelCSV = 'CSV for Ms Excel data';
|
||||
$strTables = '%s table(s)'; //to translate
|
||||
$strUseBackquotes = 'Use backquotes with tables and fields\' names';
|
||||
$strDatabasesStats = 'Databases statistics';//to translate
|
||||
?>
|
||||
|
@@ -231,6 +231,11 @@ if ($server > 0
|
||||
<a href="user_details.php3?<?php echo $common_url_query; ?>&db=mysql&table=user">
|
||||
<?php echo $strUsers; ?></a> <?php echo show_docu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="db_stats.php3?<?php echo $common_url_query; ?>">
|
||||
<?php echo $strDatabasesStats; ?></a>
|
||||
</li>
|
||||
|
||||
<?php
|
||||
echo "\n";
|
||||
}
|
||||
@@ -290,6 +295,10 @@ if ($server > 0
|
||||
<li>
|
||||
<a href="user_details.php3?<?php echo $common_url_query; ?>&db=mysql&table=user">
|
||||
<?php echo $strUsers; ?></a> <?php echo show_docu('manual_Privilege_system.html#Privilege_system') . "\n"; ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="db_stats.php3?<?php echo $common_url_query; ?>">
|
||||
<?php echo $strDatabasesStats; ?></a>
|
||||
</li>
|
||||
<?php
|
||||
echo "\n";
|
||||
|
Reference in New Issue
Block a user