37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
// Health check endpoint - returns number of tables in thetool database
|
|
|
|
// Define required constants before loading config
|
|
define('FRONKDB_SQLDEBUG', false);
|
|
|
|
// Load the framework's database configuration
|
|
require_once(__DIR__ . "/../../config/config.php");
|
|
|
|
// Load the autoloader to get FronkDB class
|
|
require_once(__DIR__ . "/../../lib/autoloader/autoloader.php");
|
|
require_once(__DIR__ . "/../../lib/mvcfronk/mfLog/mfLoghandler.php");
|
|
require_once(__DIR__ . "/../../lib/FronkDB/FronkDB.php");
|
|
|
|
// Connect to the database using the framework's configuration
|
|
$db = new FronkDB(
|
|
FRONKDB_DBHOST,
|
|
FRONKDB_DBUSER,
|
|
FRONKDB_DBPASS,
|
|
FRONKDB_DBNAME
|
|
);
|
|
|
|
// Query to count tables in the thetool database
|
|
$sql = "SELECT COUNT(*) as count FROM information_schema.tables WHERE table_schema = 'thetool'";
|
|
$result = $db->query($sql);
|
|
|
|
if ($result) {
|
|
$row = $db->fetch_array($result);
|
|
$tableCount = (int)$row['count'];
|
|
} else {
|
|
$tableCount = 0;
|
|
}
|
|
|
|
// Return JSON response
|
|
header('Content-Type: application/json');
|
|
echo json_encode(['tables' => $tableCount]);
|