Initial Kaffeekasse SaaS restart
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
$app = require dirname(__DIR__) . '/app/bootstrap.php';
|
||||
|
||||
$status = [
|
||||
'app_env' => $app['config']['env'],
|
||||
'database_configured' => $app['database']->isConfigured(),
|
||||
'installed' => is_file(dirname(__DIR__) . '/storage/installed.lock'),
|
||||
];
|
||||
|
||||
try {
|
||||
if ($status['database_configured']) {
|
||||
$count = $app['database']->pdo()->query('SELECT COUNT(*) FROM tenants')->fetchColumn();
|
||||
$status['database_reachable'] = true;
|
||||
$status['tenant_count'] = (int) $count;
|
||||
} else {
|
||||
$status['database_reachable'] = false;
|
||||
}
|
||||
} catch (\Throwable $throwable) {
|
||||
$status['database_reachable'] = false;
|
||||
$status['error'] = $throwable->getMessage();
|
||||
}
|
||||
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($status, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL;
|
||||
Reference in New Issue
Block a user