Tidy debug

This commit is contained in:
johnnyq
2023-05-31 13:37:43 -04:00
parent 386eb0c382
commit 0c9f50fbda
+35 -49
View File
@@ -136,35 +136,11 @@ if ($currentStructure === null) {
// Compare the structures and display the differences
$differences = arrayDiffRecursive($desiredStructure, $currentStructure);
?>
<div class="card card-dark">
<div class="card-header py-3">
<h3 class="card-title"><i class="fas fa-fw fa-bug mr-2"></i>Debug</h3>
</div>
<div class="card-body">
<h3>Database Structure Check</h3>
<?php
if (empty($differences)) {
echo "The database structure matches the desired structure.";
} else {
echo "Differences found:\n";
print_r($differences);
}
?>
<hr>
<h4>Database stats</h4>
<?php
//DB Stats
// Query to fetch the number of tables
$tablesQuery = "SHOW TABLES";
$tablesResult = $mysqli->query($tablesQuery);
// Check if the query was successful
if ($tablesResult) {
$numTables = $tablesResult->num_rows;
$numFields = 0;
$numRows = 0;
@@ -196,35 +172,48 @@ $differences = arrayDiffRecursive($desiredStructure, $currentStructure);
}
}
echo "Number of tables: " . $numTables . "<br>";
echo "Total number of fields: " . $numFields . "<br>";
echo "Total number of rows: " . $numRows . "<br>";
} else {
echo "Error executing query: " . $mysqli->error;
}
// Query to fetch the database size
$query = "SELECT table_schema AS 'Database', SUM(data_length + index_length) / (1024 * 1024) AS 'Size (MB)'
FROM information_schema.TABLES WHERE table_schema = '$database'
GROUP BY table_schema";
$result = $mysqli->query($query);
//Get loaded PHP modules
$loadedModules = get_loaded_extensions();
// Check if the query was successful
if ($result) {
$row = $result->fetch_assoc();
$dbSize = $row['Size (MB)'];
echo "Database Size: " . $dbSize . " MB";
} else {
echo "Error executing query: " . $conn->error;
}
//Get Versions
$phpVersion = phpversion();
$mysqlVersion = $mysqli->server_version;
$operatingSystem = shell_exec('uname -a');
?>
<div class="card card-dark">
<div class="card-header py-3">
<h3 class="card-title"><i class="fas fa-fw fa-bug mr-2"></i>Debug</h3>
</div>
<div class="card-body">
<h3>Database Structure Check</h3>
<?php
if (empty($differences)) {
echo "The database structure matches the desired structure.";
} else {
echo "Differences found:\n";
print_r($differences);
}
?>
<hr>
<h3>Installed PHP Modules</h3>
<h4>Database stats</h4>
<?php
echo "Number of tables: " . $numTables . "<br>";
echo "Total number of fields: " . $numFields . "<br>";
echo "Total number of rows: " . $numRows . "<br>";
?>
<hr>
<h3>PHP Modules Installed</h3>
<?php
$loadedModules = get_loaded_extensions();
foreach ($loadedModules as $module) {
echo $module . "<br>";
}
@@ -235,15 +224,12 @@ $differences = arrayDiffRecursive($desiredStructure, $currentStructure);
<h3>Versions</h3>
<?php
$phpVersion = phpversion();
echo "PHP version: " . $phpVersion;
echo "<br>";
$mysqlVersion = $mysqli->server_version;
echo "MySQL Version: " . $mysqlVersion;
echo "<br>";
$operatingSystem = shell_exec('uname -a');
echo "Operating System: " . $operatingSystem;
?>