Localisation updates from https://translatewiki.net.
[lhc/web/wiklou.git] / includes / context / RequestContext.php
index 16f11ee..8056b4d 100644 (file)
@@ -510,10 +510,11 @@ class RequestContext implements IContextSource, MutableContext {
         * @since 1.21
         */
        public function exportSession() {
+               $session = MediaWiki\Session\SessionManager::getGlobalSession();
                return array(
                        'ip' => $this->getRequest()->getIP(),
                        'headers' => $this->getRequest()->getAllHeaders(),
-                       'sessionId' => MediaWiki\Session\SessionManager::getGlobalSession()->getId(),
+                       'sessionId' => $session->isPersistent() ? $session->getId() : '',
                        'userId' => $this->getUser()->getId()
                );
        }
@@ -576,8 +577,9 @@ class RequestContext implements IContextSource, MutableContext {
                        // Get new session, if applicable
                        $session = null;
                        if ( strlen( $params['sessionId'] ) ) { // don't make a new random ID
-                               $session = MediaWiki\Session\SessionManager::singleton()
-                                       ->getSessionById( $params['sessionId'] );
+                               $manager = MediaWiki\Session\SessionManager::singleton();
+                               $session = $manager->getSessionById( $params['sessionId'], true )
+                                       ?: $manager->getEmptySession();
                        }
 
                        // Remove any user IP or agent information, and attach the request