Use InvalidArgumentException in ActivityUpdateJob
[lhc/web/wiklou.git] / includes / Setup.php
index b7d0f42..9d434de 100644 (file)
@@ -505,6 +505,7 @@ if ( !$wgSessionsInObjectCache && !$wgSessionsInMemcached ) {
        }
        $cacheType = get_class( ObjectCache::getInstance( $wgSessionCacheType ) );
        wfDebugLog(
+               'caches',
                "Session data will be stored in \"$cacheType\" cache with " .
                        "expiry $wgObjectCacheSessionExpiry seconds"
        );
@@ -538,13 +539,15 @@ require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
 $ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
 
 // T48998: Bail out early if $wgArticlePath is non-absolute
-if ( !preg_match( '/^(https?:\/\/|\/)/', $wgArticlePath ) ) {
-       throw new FatalError(
-               'If you use a relative URL for $wgArticlePath, it must start ' .
-               'with a slash (<code>/</code>).<br><br>See ' .
-               '<a href="https://www.mediawiki.org/wiki/Manual:$wgArticlePath">' .
-               'https://www.mediawiki.org/wiki/Manual:$wgArticlePath</a>.'
-       );
+foreach ( array( 'wgArticlePath', 'wgVariantArticlePath' ) as $varName ) {
+       if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
+               throw new FatalError(
+                       "If you use a relative URL for \$$varName, it must start " .
+                       'with a slash (<code>/</code>).<br><br>See ' .
+                       "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
+                       "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
+               );
+       }
 }
 
 Profiler::instance()->scopedProfileOut( $ps_validation );
@@ -689,6 +692,11 @@ if ( !is_object( $wgAuth ) ) {
 
 // Set up the session
 $ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
+/**
+ * @var MediaWiki\\Session\\SessionId|null $wgInitialSessionId The persistent
+ * session ID (if any) loaded at startup
+ */
+$wgInitialSessionId = null;
 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
        // If session.auto_start is there, we can't touch session name
        if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
@@ -721,12 +729,17 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
                throw $ex;
        }
 
+       if ( $session->isPersistent() ) {
+               $wgInitialSessionId = $session->getSessionId();
+       }
+
        $session->renew();
        if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
                ( $session->isPersistent() || $session->shouldRememberUser() )
        ) {
                // Start the PHP-session for backwards compatibility
                session_id( $session->getId() );
+               MediaWiki\quietCall( 'session_cache_limiter', 'private, must-revalidate' );
                MediaWiki\quietCall( 'session_start' );
        }
 }