Don't increment stats when called from the scripts.
authorPlatonides <platonides@users.mediawiki.org>
Sun, 31 Oct 2010 22:25:29 +0000 (22:25 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Sun, 31 Oct 2010 22:25:29 +0000 (22:25 +0000)
This avoids things like PHPUnit opening a db connection just for this due to the default SqDlBagOStuff.

includes/Setup.php

index 8e59c2a..732e46c 100644 (file)
@@ -308,13 +308,15 @@ if( !wfIniGetBool( 'session.auto_start' ) )
        session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
 
 if( !defined( 'MW_NO_SESSION' ) ) {
-       if( !$wgCommandLineMode && ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix.'Token'] ) ) ) {
-               wfIncrStats( 'request_with_session' );
-               wfSetupSession();
-               $wgSessionStarted = true;
-       } else {
-               wfIncrStats( 'request_without_session' );
-               $wgSessionStarted = false;
+       if ( !$wgCommandLineMode ) {
+               if( ( $wgRequest->checkSessionCookie() || isset( $_COOKIE[$wgCookiePrefix.'Token'] ) ) ) {
+                       wfIncrStats( 'request_with_session' );
+                       wfSetupSession();
+                       $wgSessionStarted = true;
+               } else {
+                       wfIncrStats( 'request_without_session' );
+                       $wgSessionStarted = false;
+               }
        }
 }