From 78efb0b0886c01c242cfc2c14acec9363daaff69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20M=C3=BCller?= Date: Mon, 20 Aug 2001 20:39:44 +0000 Subject: [PATCH] small new feature: stats overview about all databases of a server --- ChangeLog | 5 + db_stats.php3 | 153 +++++++++++++++++++++++++++++ lang/brazilian_portuguese.inc.php3 | 1 + lang/bulgarian-win1251.inc.php3 | 1 + lang/catala.inc.php3 | 1 + lang/chinese_big5.inc.php3 | 1 + lang/chinese_gb.inc.php3 | 1 + lang/czech-iso.inc.php3 | 1 + lang/czech-win1250.inc.php3 | 1 + lang/danish.inc.php3 | 1 + lang/dutch.inc.php3 | 1 + lang/english.inc.php3 | 1 + lang/french.inc.php3 | 1 + lang/german.inc.php3 | 3 +- lang/italian.inc.php3 | 1 + lang/japanese.inc.php3 | 1 + lang/korean.inc.php3 | 1 + lang/norwegian.inc.php3 | 1 + lang/polish.inc.php3 | 1 + lang/portuguese.inc.php3 | 1 + lang/russian-koi8.inc.php3 | 1 + lang/russian-win1251.inc.php3 | 1 + lang/slovak-iso.inc.php3 | 1 + lang/spanish.inc.php3 | 1 + lang/swedish.inc.php3 | 1 + lang/thai.inc.php3 | 1 + main.php3 | 9 ++ 27 files changed, 191 insertions(+), 2 deletions(-) create mode 100644 db_stats.php3 diff --git a/ChangeLog b/ChangeLog index 080bd5c74..b5558fa87 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ phpMyAdmin - Changelog $Id$ $Source$ +2001-08-20 Olivier Müller + * 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 * config.inc.php3: $cfgProtectBlob is now TRUE by default, to help against the blob data corruption of some browsers. diff --git a/db_stats.php3 b/db_stats.php3 new file mode 100644 index 000000000..a40eeb8e8 --- /dev/null +++ b/db_stats.php3 @@ -0,0 +1,153 @@ + 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 + */ +?> + + + + + phpMyAdmin + + + + + +

- + +

+

+ + + + + + + + + + + + 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 ""; + echo ""; + echo ""; + echo ""; + echo ""; + + } + + echo "
" . urlencode($db) . " $tot_data_format $unit_data $tot_idx_format $unit_idx $tot_all_format $unit_all
"; + +} // end if ($num_dbs == 1) +else { + echo "\n"; + echo '

' . $strNoDatabases . '

'; +} // end if ($num_dbs == 0) +echo "\n"; +?> + + + diff --git a/lang/brazilian_portuguese.inc.php3 b/lang/brazilian_portuguese.inc.php3 index 75bcd1b48..2280cbcc8 100644 --- a/lang/brazilian_portuguese.inc.php3 +++ b/lang/brazilian_portuguese.inc.php3 @@ -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 ?> diff --git a/lang/bulgarian-win1251.inc.php3 b/lang/bulgarian-win1251.inc.php3 index 39026bd97..37c1ba241 100644 --- a/lang/bulgarian-win1251.inc.php3 +++ b/lang/bulgarian-win1251.inc.php3 @@ -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 ?> diff --git a/lang/catala.inc.php3 b/lang/catala.inc.php3 index f95215778..84149e950 100644 --- a/lang/catala.inc.php3 +++ b/lang/catala.inc.php3 @@ -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 ?> diff --git a/lang/chinese_big5.inc.php3 b/lang/chinese_big5.inc.php3 index 9e5d40c40..59f7f4b82 100644 --- a/lang/chinese_big5.inc.php3 +++ b/lang/chinese_big5.inc.php3 @@ -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 ?> diff --git a/lang/chinese_gb.inc.php3 b/lang/chinese_gb.inc.php3 index 7746aaf02..60cbec068 100644 --- a/lang/chinese_gb.inc.php3 +++ b/lang/chinese_gb.inc.php3 @@ -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 ?> diff --git a/lang/czech-iso.inc.php3 b/lang/czech-iso.inc.php3 index 3e9ec5f11..4a29bb1c0 100644 --- a/lang/czech-iso.inc.php3 +++ b/lang/czech-iso.inc.php3 @@ -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 ?> diff --git a/lang/czech-win1250.inc.php3 b/lang/czech-win1250.inc.php3 index 2e8766ee4..17fed823b 100644 --- a/lang/czech-win1250.inc.php3 +++ b/lang/czech-win1250.inc.php3 @@ -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 ?> diff --git a/lang/danish.inc.php3 b/lang/danish.inc.php3 index 43d78996d..5ba469698 100644 --- a/lang/danish.inc.php3 +++ b/lang/danish.inc.php3 @@ -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 ?> diff --git a/lang/dutch.inc.php3 b/lang/dutch.inc.php3 index 56e1b0f13..875d30a47 100644 --- a/lang/dutch.inc.php3 +++ b/lang/dutch.inc.php3 @@ -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 ?> diff --git a/lang/english.inc.php3 b/lang/english.inc.php3 index 04e9b8acf..991b5d7d0 100644 --- a/lang/english.inc.php3 +++ b/lang/english.inc.php3 @@ -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'; diff --git a/lang/french.inc.php3 b/lang/french.inc.php3 index 856f1cec8..01bbda088 100644 --- a/lang/french.inc.php3 +++ b/lang/french.inc.php3 @@ -69,6 +69,7 @@ $strCriteria = 'Crit $strData = 'Données'; $strDatabase = 'Base de données'; $strDatabases = 'bases de données'; +$strDatabasesStats = 'Statistiques sur les bases de données'; $strDataOnly = 'Données seulement'; $strDbEmpty = 'Le nom de la base de données est vide'; $strDefault = 'Défaut'; diff --git a/lang/german.inc.php3 b/lang/german.inc.php3 index ea57a1206..0e6aee5eb 100644 --- a/lang/german.inc.php3 +++ b/lang/german.inc.php3 @@ -69,6 +69,7 @@ $strCriteria = 'Kriterium'; $strData = 'Daten'; $strDatabase = 'Datenbank '; $strDatabases = 'Datenbanken'; +$strDatabasesStats = 'Statistiken ü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 ?> diff --git a/lang/italian.inc.php3 b/lang/italian.inc.php3 index 0942c94f7..78aabc219 100644 --- a/lang/italian.inc.php3 +++ b/lang/italian.inc.php3 @@ -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 ?> diff --git a/lang/japanese.inc.php3 b/lang/japanese.inc.php3 index 13571e88b..b6dbd3be6 100644 --- a/lang/japanese.inc.php3 +++ b/lang/japanese.inc.php3 @@ -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 ?> diff --git a/lang/korean.inc.php3 b/lang/korean.inc.php3 index f10196935..71640b844 100644 --- a/lang/korean.inc.php3 +++ b/lang/korean.inc.php3 @@ -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 ?> diff --git a/lang/norwegian.inc.php3 b/lang/norwegian.inc.php3 index 9d37431ea..aefa145b6 100644 --- a/lang/norwegian.inc.php3 +++ b/lang/norwegian.inc.php3 @@ -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 ?> diff --git a/lang/polish.inc.php3 b/lang/polish.inc.php3 index fe021706d..0abdfec31 100644 --- a/lang/polish.inc.php3 +++ b/lang/polish.inc.php3 @@ -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\'...
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 ?> diff --git a/lang/portuguese.inc.php3 b/lang/portuguese.inc.php3 index 1453c6f72..50526162d 100644 --- a/lang/portuguese.inc.php3 +++ b/lang/portuguese.inc.php3 @@ -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 ?> diff --git a/lang/russian-koi8.inc.php3 b/lang/russian-koi8.inc.php3 index 7e47d6631..752018fe8 100644 --- a/lang/russian-koi8.inc.php3 +++ b/lang/russian-koi8.inc.php3 @@ -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 ?> diff --git a/lang/russian-win1251.inc.php3 b/lang/russian-win1251.inc.php3 index bde30e511..270aa1f5b 100644 --- a/lang/russian-win1251.inc.php3 +++ b/lang/russian-win1251.inc.php3 @@ -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 ?> diff --git a/lang/slovak-iso.inc.php3 b/lang/slovak-iso.inc.php3 index 24eb2fd27..00623e1c5 100644 --- a/lang/slovak-iso.inc.php3 +++ b/lang/slovak-iso.inc.php3 @@ -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 ?> diff --git a/lang/spanish.inc.php3 b/lang/spanish.inc.php3 index 7b431af65..3e553b511 100644 --- a/lang/spanish.inc.php3 +++ b/lang/spanish.inc.php3 @@ -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 ?> diff --git a/lang/swedish.inc.php3 b/lang/swedish.inc.php3 index 1ca592684..6c85e745a 100644 --- a/lang/swedish.inc.php3 +++ b/lang/swedish.inc.php3 @@ -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 ?> diff --git a/lang/thai.inc.php3 b/lang/thai.inc.php3 index d548cf051..50cbc6f43 100644 --- a/lang/thai.inc.php3 +++ b/lang/thai.inc.php3 @@ -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 ?> diff --git a/main.php3 b/main.php3 index 03a6f445e..0c45d230e 100755 --- a/main.php3 +++ b/main.php3 @@ -231,6 +231,11 @@ if ($server > 0   +
  • + + +
  • + 0   +
  • + + +