Merge "Improve how slashes are stripped from filenames"
[lhc/web/wiklou.git] / includes / session / SessionBackend.php
index 2626aa8..264e1ae 100644 (file)
@@ -94,6 +94,8 @@ final class SessionBackend {
        private $usePhpSessionHandling = true;
        private $checkPHPSessionRecursionGuard = false;
 
+       private $shutdown = false;
+
        /**
         * @param SessionId $id Session ID object
         * @param SessionInfo $info Session info to populate from
@@ -181,12 +183,21 @@ final class SessionBackend {
         */
        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