Merge "Enforce MW_NO_SESSION, add MW_NO_SESSION_HANDLER"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 22 Feb 2016 23:49:12 +0000 (23:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 22 Feb 2016 23:49:12 +0000 (23:49 +0000)
1  2 
includes/session/SessionManager.php

@@@ -168,6 -168,7 +168,6 @@@ final class SessionManager implements S
                        $store = $options['store'];
                } else {
                        $store = \ObjectCache::getInstance( $this->config->get( 'SessionCacheType' ) );
 -                      $store->setLogger( $this->logger );
                }
                $this->store = $store instanceof CachedBagOStuff ? $store : new CachedBagOStuff( $store );
  
         * @return Session
         */
        public function getSessionFromInfo( SessionInfo $info, WebRequest $request ) {
+               if ( defined( 'MW_NO_SESSION' ) ) {
+                       if ( MW_NO_SESSION === 'warn' ) {
+                               // Undocumented safety case for converting existing entry points
+                               $this->logger->error( 'Sessions are supposed to be disabled for this entry point' );
+                       } else {
+                               throw new \BadMethodCallException( 'Sessions are disabled for this entry point' );
+                       }
+               }
                $id = $info->getId();
  
                if ( !isset( $this->allSessionBackends[$id] ) ) {