dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Change .tocnumber to use grey text for section numbers in Table of Contents...
[lhc/web/wiklou.git]
/
includes
/
session
/
SessionBackend.php
diff --git
a/includes/session/SessionBackend.php
b/includes/session/SessionBackend.php
index
264e1ae
..
8633715
100644
(file)
--- a/
includes/session/SessionBackend.php
+++ b/
includes/session/SessionBackend.php
@@
-586,11
+586,11
@@
final class SessionBackend {
*
* Calls to save() will not be delayed.
*
*
* 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++;
*/
public function delaySave() {
$this->delaySave++;
- return new \ScopedCallback( function () {
+ return new \
Wikimedia\
ScopedCallback( function () {
if ( --$this->delaySave <= 0 ) {
$this->delaySave = 0;
$this->save();
if ( --$this->delaySave <= 0 ) {
$this->delaySave = 0;
$this->save();
@@
-599,7
+599,8
@@
final class SessionBackend {
}
/**
}
/**
- * Save and persist session data, unless delayed
+ * Save the session, unless delayed
+ * @see SessionBackend::save()
*/
private function autosave() {
if ( $this->delaySave <= 0 ) {
*/
private function autosave() {
if ( $this->delaySave <= 0 ) {
@@
-608,7
+609,12
@@
final class SessionBackend {
}
/**
}
/**
- * Save and persist session data
+ * Save the session
+ *
+ * Update both the backend data and the associated WebRequest(s) to
+ * reflect the state of the the SessionBackend. This might include
+ * persisting or unpersisting the session.
+ *
* @param bool $closing Whether the session is being closed
*/
public function save( $closing = false ) {
* @param bool $closing Whether the session is being closed
*/
public function save( $closing = false ) {
@@
-636,7
+642,11
@@
final class SessionBackend {
] );
$this->user->setToken();
if ( !wfReadOnly() ) {
] );
$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;
}
}
$this->metaDirty = true;
}
@@
-716,6
+726,8
@@
final class SessionBackend {
}
}
}
}
+ $flags = $this->persist ? 0 : CachedBagOStuff::WRITE_CACHE_ONLY;
+ $flags |= CachedBagOStuff::WRITE_SYNC; // write to all datacenters
$this->store->set(
wfMemcKey( 'MWSession', (string)$this->id ),
[
$this->store->set(
wfMemcKey( 'MWSession', (string)$this->id ),
[
@@
-723,7
+735,7
@@
final class SessionBackend {
'metadata' => $metadata,
],
$metadata['expires'],
'metadata' => $metadata,
],
$metadata['expires'],
- $
this->persist ? 0 : CachedBagOStuff::WRITE_CACHE_ONLY
+ $
flags
);
$this->metaDirty = false;
);
$this->metaDirty = false;
@@
-739,7
+751,7
@@
final class SessionBackend {
private function checkPHPSession() {
if ( !$this->checkPHPSessionRecursionGuard ) {
$this->checkPHPSessionRecursionGuard = true;
private function checkPHPSession() {
if ( !$this->checkPHPSessionRecursionGuard ) {
$this->checkPHPSessionRecursionGuard = true;
- $reset = new \ScopedCallback( function () {
+ $reset = new \
Wikimedia\
ScopedCallback( function () {
$this->checkPHPSessionRecursionGuard = false;
} );
$this->checkPHPSessionRecursionGuard = false;
} );