/**
* This is the actual workhorse for Session.
*
- * Most code does not need to use this class, you want \\MediaWiki\\Session\\Session.
+ * Most code does not need to use this class, you want \MediaWiki\Session\Session.
* The exceptions are SessionProviders and SessionMetadata hook functions,
* which get an instance of this class rather than Session.
*
private $usePhpSessionHandling = true;
private $checkPHPSessionRecursionGuard = false;
+ private $shutdown = false;
+
/**
* @param SessionId $id Session ID object
* @param SessionInfo $info Session info to populate from
/**
* Deregister a Session
- * @private For use by \\MediaWiki\\Session\\Session::__destruct() only
+ * @private For use by \MediaWiki\Session\Session::__destruct() only
* @param int $index
*/
public function deregisterSession( $index ) {
unset( $this->requests[$index] );
- if ( !count( $this->requests ) ) {
+ if ( !$this->shutdown && !count( $this->requests ) ) {
$this->save( true );
$this->provider->getManager()->deregisterSessionBackend( $this );
}
}
+ /**
+ * Shut down a session
+ * @private For use by \MediaWiki\Session\SessionManager::shutdown() only
+ */
+ public function shutdown() {
+ $this->save( true );
+ $this->shutdown = true;
+ }
+
/**
* Returns the session ID.
* @return string
* Note the caller is responsible for calling $this->dirty() if anything in
* the array is changed.
*
- * @private For use by \\MediaWiki\\Session\\Session only.
+ * @private For use by \MediaWiki\Session\Session only.
* @return array
*/
public function &getData() {
/**
* Mark data as dirty
- * @private For use by \\MediaWiki\\Session\\Session only.
+ * @private For use by \MediaWiki\Session\Session only.
*/
public function dirty() {
$this->dataDirty = true;