Merge "Add support for blacklisting common passwords"
[lhc/web/wiklou.git] / includes / Setup.php
index 0b6b018..a94bd12 100644 (file)
@@ -238,7 +238,10 @@ if ( $wgUseInstantCommons ) {
                'class' => 'ForeignAPIRepo',
                'name' => 'wikimediacommons',
                'apibase' => 'https://commons.wikimedia.org/w/api.php',
+               'url' => 'https://upload.wikimedia.org/wikipedia/commons',
+               'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
                'hashLevels' => 2,
+               'transformVia404' => true,
                'fetchDescription' => true,
                'descriptionCacheExpiry' => 43200,
                'apiThumbCacheExpiry' => 86400,
@@ -377,9 +380,12 @@ if ( $wgResourceLoaderMaxQueryLength === false ) {
 // upload size.
 $wgMinUploadChunkSize = min(
        $wgMinUploadChunkSize,
-       $wgMaxUploadSize,
-       wfShorthandToInteger( ini_get( 'upload_max_filesize' ), 1e100 ),
-       wfShorthandToInteger( ini_get( 'post_max_size' ), 1e100 ) - 1024 # Leave room for other parameters
+       UploadBase::getMaxUploadSize( 'file' ),
+       UploadBase::getMaxPhpUploadSize(),
+       ( wfShorthandToInteger(
+               ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
+               PHP_INT_MAX
+       ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
 );
 
 /**
@@ -415,11 +421,9 @@ if ( is_array( $wgExtraNamespaces ) ) {
 // To determine the user language, use $wgLang->getCode()
 $wgContLanguageCode = $wgLanguageCode;
 
-// Easy to forget to falsify $wgShowIPinHeader for static caches.
+// Easy to forget to falsify $wgDebugToolbar for static caches.
 // If file cache or squid cache is on, just disable this (DWIMD).
-// Do the same for $wgDebugToolbar.
 if ( $wgUseFileCache || $wgUseSquid ) {
-       $wgShowIPinHeader = false;
        $wgDebugToolbar = false;
 }
 
@@ -468,11 +472,6 @@ if ( $wgCookieSecure === 'detect' ) {
        $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
 }
 
-// Back compatibility for $wgRateLimitLog deprecated with 1.23
-if ( $wgRateLimitLog && !array_key_exists( 'ratelimit', $wgDebugLogGroups ) ) {
-       $wgDebugLogGroups['ratelimit'] = $wgRateLimitLog;
-}
-
 if ( $wgProfileOnly ) {
        $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
        $wgDebugLogFile = '';
@@ -510,6 +509,21 @@ MWExceptionHandler::installHandler();
 
 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>.'
+       );
+}
+
+Profiler::instance()->scopedProfileOut( $ps_validation );
+
 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
 
 if ( $wgCanonicalServer === false ) {
@@ -621,7 +635,10 @@ $wgMemc = wfGetMainCache();
 $messageMemc = wfGetMessageCacheStorage();
 $parserMemc = wfGetParserCacheStorage();
 
-wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
+wfDebugLog( 'caches',
+       'cluster: ' . get_class( $wgMemc ) .
+       ', WAN: ' . $wgMainWANCache .
+       ', stash: ' . $wgMainStash .
        ', message: ' . get_class( $messageMemc ) .
        ', parser: ' . get_class( $parserMemc ) );