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 // Compare the structures and display the differences
$differences = arrayDiffRecursive($desiredStructure, $currentStructure); $differences = arrayDiffRecursive($desiredStructure, $currentStructure);
?> //DB Stats
<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
// Query to fetch the number of tables // Query to fetch the number of tables
$tablesQuery = "SHOW TABLES"; $tablesQuery = "SHOW TABLES";
$tablesResult = $mysqli->query($tablesQuery); $tablesResult = $mysqli->query($tablesQuery);
// Check if the query was successful
if ($tablesResult) {
$numTables = $tablesResult->num_rows; $numTables = $tablesResult->num_rows;
$numFields = 0; $numFields = 0;
$numRows = 0; $numRows = 0;
@@ -196,35 +172,48 @@ $differences = arrayDiffRecursive($desiredStructure, $currentStructure);
} }
} }
echo "Number of tables: " . $numTables . "<br>"; //Get loaded PHP modules
echo "Total number of fields: " . $numFields . "<br>"; $loadedModules = get_loaded_extensions();
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);
// Check if the query was successful //Get Versions
if ($result) { $phpVersion = phpversion();
$row = $result->fetch_assoc(); $mysqlVersion = $mysqli->server_version;
$dbSize = $row['Size (MB)']; $operatingSystem = shell_exec('uname -a');
echo "Database Size: " . $dbSize . " MB";
} else {
echo "Error executing query: " . $conn->error;
}
?>
<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> <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 <?php
$loadedModules = get_loaded_extensions();
foreach ($loadedModules as $module) { foreach ($loadedModules as $module) {
echo $module . "<br>"; echo $module . "<br>";
} }
@@ -235,15 +224,12 @@ $differences = arrayDiffRecursive($desiredStructure, $currentStructure);
<h3>Versions</h3> <h3>Versions</h3>
<?php <?php
$phpVersion = phpversion();
echo "PHP version: " . $phpVersion; echo "PHP version: " . $phpVersion;
echo "<br>"; echo "<br>";
$mysqlVersion = $mysqli->server_version;
echo "MySQL Version: " . $mysqlVersion; echo "MySQL Version: " . $mysqlVersion;
echo "<br>"; echo "<br>";
$operatingSystem = shell_exec('uname -a');
echo "Operating System: " . $operatingSystem; echo "Operating System: " . $operatingSystem;
?> ?>