web: fix ops/sample_table_stats.php (shows details of DB tables)

This commit is contained in:
David Anderson 2024-12-14 20:36:22 -08:00
parent 14a2a26179
commit 8a9f4f8e62
2 changed files with 9 additions and 9 deletions

View File

@ -97,6 +97,7 @@ echo "
<li><a href=\"db_form.php?table=app_version\">Application versions</a></li>
<li><a href=\"db_action.php?table=platform\">Platforms</a></li>
<li><a href=dbinfo.php>DB row counts and disk usage</a>
<li><a href=sample_table_stats.php>DB table details</a>
<li><a href=\"show_log.php?f=mysql*.log&amp;l=-20\">Tail MySQL logs</a>
</ul>

View File

@ -16,20 +16,21 @@
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// show detailed info about the tables in project's DB
require_once("../inc/util_ops.inc");
function showTableStatus($db) {
function showTableStatus() {
$size = 0;
$out = "";
start_table();
row1($db, 15);
row_array(array("Name", "Engine", "Version", "Row Format", "Rows", "Avg Row Length (KB)", "Data Length (MB)", "Max Data Length (MB)", "Index Length (MB)", "Data free (MB)", "Create Time", "Update Time", "Check Time", "Create Options", "Comment"));
_mysql_select_db($db);
db_init();
$result = _mysql_query("show table status");
while($row = _mysql_fetch_array($result)) {
$size += ($row["Data_length"] + $row["Index_length"]);
$engine = $row["Engine"];
if (!$engine) $engine = $row["Type"];
//if (!$engine) $engine = $row["Type"];
row_array(array(
$row["Name"],
$engine,
@ -55,11 +56,9 @@ function showTableStatus($db) {
}
db_init();
page_head("MySQL Table Stats");
admin_page_head("MySQL Table Stats");
// add the databases you want to keep track of here
//
showTableStatus("boinc_alpha");
showTableStatus("cplan");
showTableStatus();
admin_page_tail();
?>