-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_system.php
More file actions
43 lines (32 loc) · 1.42 KB
/
debug_system.php
File metadata and controls
43 lines (32 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
require_once __DIR__ . '/vendor/autoload.php';
use HMS\Core\Database;
use Dotenv\Dotenv;
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
echo "Testing SystemAdminController::system logic...\n";
try {
$db = Database::getInstance();
echo "Query 1: Total Users... ";
$users = $db->fetch("SELECT COUNT(*) as c FROM users");
echo "OK ({$users['c']})\n";
echo "Query 2: Total Patients... ";
$patients = $db->fetch("SELECT COUNT(*) as c FROM patients");
echo "OK ({$patients['c']})\n";
echo "Query 3: Total Appointments... ";
$appts = $db->fetch("SELECT COUNT(*) as c FROM appointments");
echo "OK ({$appts['c']})\n";
// Test a failure case - maybe 'logs' or something else?
// The previous error was "Error: SQL..." which implies a DB exception.
// Check if there are other pollers in hms-app.js
// I recall only notifications and live clock (which is JS).
// Maybe the user is on a page that does an AJAX load?
// Let's check if the 'settings' table creation in update_settings_schema.php had issues with 'boolean' type?
// MySQL doesn't have 'boolean', it uses TINYINT(1).
// But my script used VARCHAR(20) default 'string'.
// wait, the script said: "type VARCHAR(20) DEFAULT 'string'".
// And inserted 'boolean'. That should be fine as a string "boolean".
} catch (Exception $e) {
echo "CAUGHT ERROR: " . $e->getMessage() . "\n";
}
?>