fix: harden portable host installation

This commit is contained in:
Marco0300
2026-09-01 19:26:10 +02:00
parent 5b2c64ff39
commit 323afaf832
6 changed files with 37 additions and 24 deletions
+3 -1
View File
@@ -11,7 +11,9 @@ require_once __DIR__ . '/../config/bootstrap.php';
try {
$schemaPath = __DIR__ . '/../database/schema.sql';
if (!is_readable($schemaPath)) throw new RuntimeException('database/schema.sql is missing or unreadable');
db()->exec(file_get_contents($schemaPath));
$schema = file_get_contents($schemaPath);
if ($schema === false || trim($schema) === '') throw new RuntimeException('database/schema.sql could not be read');
db()->exec($schema);
ensure_initial_administrator();
fwrite(STDOUT, "Database schema installed and initial Administrator verified.\n");
} catch (Throwable $exception) {