com web/bugs: Add basic MySQL status info: www/admin/index.php
| From: | Johannes Schlüter | Date: | Mon, 24 Jul 2017 21:18:12 +0000 |
| Subject: | com web/bugs: Add basic MySQL status info: www/admin/index.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-26235@lists.php.net to get a copy of this message | ||
Commit: 187d5a7d33777fd9cc189bc55e15aaf3014f2c77
Author: Johannes Schlüter <johannes@schlueters.de> Mon, 24 Jul 2017 23:18:12 +0200
Parents: a73344b64b51a4ba01ef367d059516056cb9daff
Branches: master
Link: http://git.php.net/?p=web/bugs.git;a=commitdiff;h=187d5a7d33777fd9cc189bc55e15aaf3014f2c77
Log:
Add basic MySQL status info
Changed paths:
M www/admin/index.php
Diff:
diff --git a/www/admin/index.php b/www/admin/index.php
index 76d5103..ad1a3c2 100644
--- a/www/admin/index.php
+++ b/www/admin/index.php
@@ -36,7 +36,8 @@ response_header("Bugs admin suite");
inline_content_menu('/admin/', $action, array(
'phpinfo' => 'phpinfo()',
'list_lists' => 'Package mailing lists',
- 'list_responses' => 'Quick fix responses'
+ 'list_responses' => 'Quick fix responses',
+ 'mysql' => 'Database status',
));
if ($action === 'list_lists') {
@@ -72,4 +73,35 @@ if ($action === 'list_responses') {
}
+if ($action === 'mysql') {
+ $res = $dbh->query("SHOW TABLES");
+
+ $sql = "SELECT version() mysql_version\n";
+
+ while ($row = $res->fetchRow(MDB2_FETCHMODE_ORDERED)) {
+ $table = $row[0];
+ $sql .= "\t, (SELECT COUNT(*) FROM
$table) cnt_$table\n";
+ }
+
+ $res = $dbh->query($sql);
+ $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
+
+ echo "<p>Running MySQL
<b>".$row['mysql_version']."</b></p>";
+ unset($row['mysql_version']);
+
+ echo "<p>Number of
rows:</p><table><tr><th>Table</th><th>#</th></tr>\n";
+ foreach ($row as $k => $v) {
+ echo "<tr><td>".str_replace("cnt_", "",
$k)."</td>"
+ ."<td>$v</td></tr>\n";
+ }
+ echo "</table>";
+
+ $res = $dbh->query("SHOW TABLE STATUS");
+ echo "<p>Table status:</p><pre>";
+ while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
+ var_dump($row);
+ }
+ echo "</pre>";
+}
+
response_footer();