mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-23 21:17:04 +00:00
fix(session): refresh the 30s user-cache after a player's own changes (#239)
This commit is contained in:
@@ -110,6 +110,11 @@ if ($session->goldclub == 1 && count($session->villages) > 1) {
|
||||
$database->editTradeRoute($_POST['routeid'], "timeleft", 604800, 1);
|
||||
$newgold = $session->gold - 2;
|
||||
$database->updateUserField($session->uid, 'gold', $newgold, 1);
|
||||
$session->gold = $newgold;
|
||||
// Invalidate the 30s session user-cache (see Session::PopulateVar) so
|
||||
// the gold balance is fresh next request; the write is absolute
|
||||
// ($session->gold - 2), so a stale cache could double-spend.
|
||||
unset($_SESSION['cache_user_' . ($_SESSION['username'] ?? '')]);
|
||||
}
|
||||
}
|
||||
$route = 1;
|
||||
|
||||
Reference in New Issue
Block a user