WEB: Don't make the cache database depend on the hostname

This avoids having two caches when accessing the website with or without
a www and this is also more robust.
Make use of the DEV_SERVER constant and allow to enable it by setting an
environment variable.
This commit is contained in:
Le Philousophe committed 2024-12-24 13:31:11 +01:00
1 parent dcbbef22a7
commit 85bbf617bb
2 files changed
+11 -3

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ abstract class BasicModel
if (is_null(self::$cache)) {
try {
$driver = extension_loaded('redis') ? 'redis' : 'predis';
$database = $_SERVER['HTTP_HOST'] === 'www.scummvm.org' ? 8 : 7;
$database = DEV_SERVER ? 7 : 8;
$config = extension_loaded('redis')
? new RedisConfig(['database' => $database])
: new PredisConfig(['database' => $database]);