module change
This commit is contained in:
@@ -113,7 +113,10 @@ final class ModuleManager
|
||||
$settings = $this->settings($name);
|
||||
$db = $settings['db'] ?? $fallback;
|
||||
if (!is_array($db) || empty($db)) {
|
||||
return null;
|
||||
throw new ModuleConfigException(
|
||||
$name,
|
||||
'Modul nicht konfiguriert. Bitte Setup ausfuehren.'
|
||||
);
|
||||
}
|
||||
|
||||
if (!isset($db['options'])) {
|
||||
@@ -123,15 +126,49 @@ final class ModuleManager
|
||||
];
|
||||
}
|
||||
|
||||
$pdo = Database::createFromArray($db);
|
||||
try {
|
||||
$pdo = Database::createFromArray($db);
|
||||
} catch (\Throwable $e) {
|
||||
if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL) {
|
||||
@file_put_contents(
|
||||
__DIR__ . '/../../debug/module_db_error.log',
|
||||
'[' . date('c') . '] ' . $name . ': ' . $e->getMessage() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
throw new ModuleConfigException(
|
||||
$name,
|
||||
'Modul-Datenbank nicht korrekt konfiguriert.',
|
||||
$e->getMessage(),
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
if ($name === 'kea' && !empty($settings['kea_auto_init'])) {
|
||||
Database::ensureKeaSchema($pdo, [
|
||||
'auto_init' => true,
|
||||
'init_cmd' => $settings['kea_init_cmd'] ?? null,
|
||||
'init_script' => $settings['kea_init_script'] ?? null,
|
||||
'kea_db_version' => $settings['kea_db_version'] ?? '',
|
||||
]);
|
||||
try {
|
||||
Database::ensureKeaSchema($pdo, [
|
||||
'auto_init' => true,
|
||||
'init_cmd' => $settings['kea_init_cmd'] ?? null,
|
||||
'init_script' => $settings['kea_init_script'] ?? null,
|
||||
'kea_db_version' => $settings['kea_db_version'] ?? '',
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
if (defined('APP_DEBUG_TOOL') && APP_DEBUG_TOOL) {
|
||||
@file_put_contents(
|
||||
__DIR__ . '/../../debug/module_db_error.log',
|
||||
'[' . date('c') . '] ' . $name . ': ' . $e->getMessage() . PHP_EOL,
|
||||
FILE_APPEND
|
||||
);
|
||||
}
|
||||
throw new ModuleConfigException(
|
||||
$name,
|
||||
'Modul-Datenbank nicht korrekt konfiguriert.',
|
||||
$e->getMessage(),
|
||||
0,
|
||||
$e
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return $pdo;
|
||||
|
||||
Reference in New Issue
Block a user