sdsfd
All checks were successful
Deploy / deploy-staging (push) Successful in 24s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-23 00:16:39 +02:00
parent 0abc406fdc
commit a4378af9cf

View File

@@ -201,17 +201,20 @@ namespace ModulesCore {
$configPath = $this->modulePath($moduleName) . '/config/module.php';
$config = is_file($configPath) ? require $configPath : [];
$defaults = is_array($config) ? $config : [];
$legacyDbSettings = $this->legacyDbSettings($moduleName);
$storedSettingsPath = $this->storedSettingsPath($moduleName);
if (!is_file($storedSettingsPath)) {
return $this->settingsCache[$moduleName] = $defaults;
return $this->settingsCache[$moduleName] = $this->mergeSettings($defaults, $legacyDbSettings);
}
$raw = file_get_contents($storedSettingsPath);
$stored = is_string($raw) && trim($raw) !== '' ? json_decode($raw, true) : [];
$merged = $this->mergeSettings($defaults, $legacyDbSettings);
return $this->settingsCache[$moduleName] = $this->mergeSettings(
$defaults,
$merged,
is_array($stored) ? $stored : []
);
}
@@ -327,6 +330,35 @@ namespace ModulesCore {
return $this->projectRoot . '/data/module-settings/' . trim($moduleName, '/') . '.json';
}
/**
* @return array<string, mixed>
*/
private function legacyDbSettings(string $moduleName): array
{
$pdo = LegacyCompat::app()->basePdo();
if (!$pdo instanceof \PDO) {
return [];
}
try {
$stmt = $pdo->prepare(
'SELECT settings FROM nexus_module_settings WHERE name = :name LIMIT 1'
);
$stmt->execute(['name' => $moduleName]);
$row = $stmt->fetch(\PDO::FETCH_ASSOC);
} catch (\Throwable) {
return [];
}
if (!is_array($row) || empty($row['settings'])) {
return [];
}
$decoded = json_decode((string) $row['settings'], true);
return is_array($decoded) ? $decoded : [];
}
/**
* @param array<string, mixed> $defaults
* @param array<string, mixed> $stored