mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-12 14:21:03 +00:00
fix(preferences): refresh session cache so saved prefs show immediately [#198]
userinfo is served from a 30s session cache (Session::PopulateVar), so a freshly saved preference (e.g. the large-map checkbox) only reflected after the cache expired or a re-login — the box appeared unchanged on OK. Invalidate the per-user session cache after saving so the redirected page reloads the values from the DB right away. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
committed by
Catalin Novgorodschi
parent
c2d8e74859
commit
9d88727aff
@@ -91,14 +91,10 @@ class Profile {
|
|||||||
"WHERE id=" . (int)$session->uid
|
"WHERE id=" . (int)$session->uid
|
||||||
);
|
);
|
||||||
|
|
||||||
// Keep the in-memory session in sync for the immediate re-render.
|
// Invalidate the 30s session user-cache (see Session::PopulateVar) so the
|
||||||
foreach ([
|
// reloaded page reflects the new values immediately, without a re-login.
|
||||||
'v1' => $v1, 'v2' => $v2, 'v3' => $v3, 'map' => $map,
|
$cacheKeyUser = 'cache_user_' . ($_SESSION['username'] ?? '');
|
||||||
'v4' => $v4, 'v5' => $v5, 'v6' => $v6,
|
unset($_SESSION[$cacheKeyUser]);
|
||||||
'timezone' => $timezone, 'tformat' => $tformat,
|
|
||||||
] as $field => $value) {
|
|
||||||
$session->userinfo[$field] = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Game language.
|
// Game language.
|
||||||
$allowed = ['en', 'fr', 'it', 'ro', 'zh'];
|
$allowed = ['en', 'fr', 'it', 'ro', 'zh'];
|
||||||
|
|||||||
Reference in New Issue
Block a user