Added basic domain history page; will be expanded

This commit is contained in:
Pinga 2025-04-07 18:46:34 +03:00
parent 6ca9e5256a
commit 5e49fbc2bb
6 changed files with 220 additions and 1 deletions

View file

@ -32,4 +32,28 @@ try {
} catch (PDOException $e) {
$log->alert("Database connection failed: " . $e->getMessage(), ['driver' => $defaultDriver]);
}
// Audit DB (optional)
try {
$auditDriver = match ($defaultDriver) {
'mysql' => "{$config['mysql']['driver']}:dbname=registryAudit;host={$config['mysql']['host']};charset={$config['mysql']['charset']}",
'sqlite' => "{$config['sqlite']['driver']}:{$config['sqlite']['audit_path']}", // assumes audit_path is set for SQLite
'pgsql' => "{$config['pgsql']['driver']}:dbname=registryAudit;host={$config['pgsql']['host']}",
default => throw new \RuntimeException('Unsupported database driver for audit'),
};
if (str_starts_with($auditDriver, "sqlite")) {
$pdo_audit = new \PDO($auditDriver);
} else {
$pdo_audit = new \PDO(
$auditDriver,
$config[$defaultDriver]['username'],
$config[$defaultDriver]['password']
);
}
$db_audit = PdoDatabase::fromPdo($pdo_audit);
} catch (PDOException $e) {
$log->alert("Audit database connection failed: " . $e->getMessage(), ['driver' => 'audit']);
}