Merge pull request 'Snelheid' (#96) from dev into main

Reviewed-on: #96
This commit was merged in pull request #96.
This commit is contained in:
2026-09-16 11:54:05 +00:00
6 changed files with 97 additions and 68 deletions
+8 -1
View File
@@ -126,8 +126,14 @@ function ensure_tables_exist(PDO $pdo): void {
if ($tablesChecked) return;
$tablesChecked = true;
$schemaFile = file_exists(__DIR__ . '/schema.sql') ? (__DIR__ . '/schema.sql') : (__DIR__ . '/../schema.sql');
$lockFile = sys_get_temp_dir() . '/fociz_schema_' . md5(__DIR__) . '.lock';
if (file_exists($lockFile) && file_exists($schemaFile) && filemtime($lockFile) >= filemtime($schemaFile)) {
return;
}
try {
$schemaFile = file_exists(__DIR__ . '/schema.sql') ? (__DIR__ . '/schema.sql') : (__DIR__ . '/../schema.sql');
if (file_exists($schemaFile)) {
$sql = file_get_contents($schemaFile);
$statements = array_filter(array_map('trim', explode(';', $sql)));
@@ -300,6 +306,7 @@ function ensure_tables_exist(PDO $pdo): void {
} catch (Throwable $e) {
// Stil negeren indien system_settings tabel nog niet bestaat
}
@touch($lockFile);
} catch (Throwable $e) {
error_log("Fout bij controleren tabellen: " . $e->getMessage());
}