X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fsession%2FSessionBackend.php;h=8633715d60c079734bb09a7b72105ce30fa594d7;hp=263cb11f54212f088634c8c725cc1927a198d8ac;hb=e758226c91935a1df2b6fd3ed1f18922d8bfb45b;hpb=57eaa2bf04ce1b48bd89c10defe4de5b7d31f047 diff --git a/includes/session/SessionBackend.php b/includes/session/SessionBackend.php index 263cb11f54..8633715d60 100644 --- a/includes/session/SessionBackend.php +++ b/includes/session/SessionBackend.php @@ -586,11 +586,11 @@ final class SessionBackend { * * Calls to save() will not be delayed. * - * @return \ScopedCallback When this goes out of scope, a save will be triggered + * @return \Wikimedia\ScopedCallback When this goes out of scope, a save will be triggered */ public function delaySave() { $this->delaySave++; - return new \ScopedCallback( function () { + return new \Wikimedia\ScopedCallback( function () { if ( --$this->delaySave <= 0 ) { $this->delaySave = 0; $this->save(); @@ -642,7 +642,11 @@ final class SessionBackend { ] ); $this->user->setToken(); if ( !wfReadOnly() ) { - $this->user->saveSettings(); + // Promise that the token set here will be valid; save it at end of request + $user = $this->user; + \DeferredUpdates::addCallableUpdate( function () use ( $user ) { + $user->saveSettings(); + } ); } $this->metaDirty = true; } @@ -747,7 +751,7 @@ final class SessionBackend { private function checkPHPSession() { if ( !$this->checkPHPSessionRecursionGuard ) { $this->checkPHPSessionRecursionGuard = true; - $reset = new \ScopedCallback( function () { + $reset = new \Wikimedia\ScopedCallback( function () { $this->checkPHPSessionRecursionGuard = false; } );