From e71939297e5cc23a13ffdb6eefb7441d6d51b9c1 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Mon, 4 Aug 2014 21:51:58 +0200 Subject: [PATCH] Don't set the session name in CLI or when sessions are deactivated It doesn't make much sense to set the session name in that case. Change-Id: I4cf237d79061d146091c3409b7ac3e19136f3fb6 --- includes/Setup.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/Setup.php b/includes/Setup.php index 03c529e5e0..3a41c05c18 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -558,15 +558,15 @@ wfRunHooks( 'SetupAfterCache' ); wfProfileIn( $fname . '-session' ); -// If session.auto_start is there, we can't touch session name -if ( !wfIniGetBool( 'session.auto_start' ) ) { - session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' ); -} +if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) { + // If session.auto_start is there, we can't touch session name + if ( !wfIniGetBool( 'session.auto_start' ) ) { + session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' ); + } -if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode && - ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) -) { - wfSetupSession(); + if ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix . 'Token'] ) ) { + wfSetupSession(); + } } wfProfileOut( $fname . '-session' ); -- 2.20.1