From cd668241a6c98c1f101a654c873ae0e3acfbfa2f Mon Sep 17 00:00:00 2001 From: Marcus Hill Date: Sat, 4 May 2024 21:02:33 +0100 Subject: [PATCH] Debugging help - Mention the PHP error log on the setup & debug pages. - Restructure the debug page to include the server info before the db structure table --- admin_debug.php | 96 ++++++++++++++++++++++++------------------------- setup.php | 3 +- 2 files changed, 49 insertions(+), 50 deletions(-) diff --git a/admin_debug.php b/admin_debug.php index 6caa66143..5c92c6b30 100644 --- a/admin_debug.php +++ b/admin_debug.php @@ -39,7 +39,7 @@ function countFilesInDirectory($dir) { // Function to compare two arrays recursively and return the differences function arrayDiffRecursive($array1, $array2) { $diff = array(); - + foreach ($array1 as $key => $value) { if (is_array($value)) { if (!isset($array2[$key]) || !is_array($array2[$key])) { @@ -56,7 +56,7 @@ function arrayDiffRecursive($array1, $array2) { } } } - + return $diff; } @@ -64,17 +64,17 @@ function arrayDiffRecursive($array1, $array2) { function loadTableStructuresFromSQLDumpURL($fileURL) { $context = stream_context_create(array('http' => array('header' => 'Accept: application/octet-stream'))); $fileContent = file_get_contents($fileURL, false, $context); - + if ($fileContent === false) { return null; } - + $structure = array(); $queries = explode(";", $fileContent); - + foreach ($queries as $query) { $query = trim($query); - + if (!empty($query)) { if (preg_match("/^CREATE TABLE `(.*)` \((.*)\)$/s", $query, $matches)) { $tableName = $matches[1]; @@ -83,7 +83,7 @@ function loadTableStructuresFromSQLDumpURL($fileURL) { } } } - + return $structure; } @@ -91,31 +91,31 @@ function loadTableStructuresFromSQLDumpURL($fileURL) { function fetchDatabaseStructureFromServer() { global $mysqli; - + $tables = array(); - + // Fetch table names $result = $mysqli->query("SHOW TABLES"); - + if ($result->num_rows > 0) { while ($row = $result->fetch_row()) { $tableName = $row[0]; $tables[$tableName] = array(); } } - + // Fetch table structures foreach ($tables as $tableName => &$table) { $result = $mysqli->query("SHOW CREATE TABLE `$tableName`"); - + if ($result->num_rows > 0) { $row = $result->fetch_row(); $table['structure'] = $row[1]; } } - + //$mysqli->close(); - + return $tables; } @@ -185,11 +185,12 @@ function get_crontab() { //Get loaded PHP modules $loadedModules = get_loaded_extensions(); -//Get Versions +//Get Server Info / Service versions $phpVersion = phpversion(); $mysqlVersion = $mysqli->server_version; -$operatingSystem = shell_exec('uname -a'); +$operatingSystem = php_uname(); $webServer = $_SERVER['SERVER_SOFTWARE']; +$errorLog = ini_get('error_log'); ?> @@ -198,20 +199,43 @@ function get_crontab() {

Debug

- -

Database Structure Check

- + +

Server Info

+ + "; + echo "MySQL Version: " . $mysqlVersion . "
"; + echo "Operating System: " . $operatingSystem . "
"; + echo "Web Server: " . $webServer . "
"; + echo "PHP Error Log: " . $errorLog + ?> +
+

File System

+ "; + echo "Total size of files in $folderPath and its subdirectories: " . $totalSizeMB . " MB"; + ?> + +
+ +

Database Structure Check

+

Database stats

- + "; echo "Total number of fields: " . $numFields . "
"; echo "Total number of rows: " . $numRows . "
"; echo "Current Database Version: " . CURRENT_DATABASE_VERSION . "
"; ?> - +

Table Stats

@@ -255,34 +279,8 @@ function get_crontab() {
-

Versions

- - "; - echo "MySQL Version: " . $mysqlVersion . "
"; - echo "Operating System: " . $operatingSystem . "
"; - echo "Web Server: " . $webServer; - - - ?> - -
- -

File System

- "; - echo "Total size of files in $folderPath and its subdirectories: " . $totalSizeMB . " MB"; - ?> - -
-

PHP Modules Installed

- + "; @@ -311,7 +309,7 @@ function get_crontab() { //Output the result echo $phpinfo; ?> - +
diff --git a/setup.php b/setup.php index 6dab7b80c..3dbbdc8fb 100644 --- a/setup.php +++ b/setup.php @@ -843,8 +843,9 @@ -

A database must be created before proceeding - click on the button below to get started

+

A database must be created before proceeding - click on the button below to get started.



ITFlow is free software: you can redistribute and/or modify it under the terms of the GNU General Public License.
It is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.