Merge "Fix rel="copyright" for ApiHelp"
[lhc/web/wiklou.git] / includes / Setup.php
index 6939f95..70c935d 100644 (file)
@@ -74,9 +74,6 @@ if ( $wgStylePath === false ) {
 if ( $wgLocalStylePath === false ) {
        $wgLocalStylePath = "$wgScriptPath/skins";
 }
-if ( $wgStyleDirectory === false ) {
-       $wgStyleDirectory = "$IP/skins";
-}
 if ( $wgExtensionAssetsPath === false ) {
        $wgExtensionAssetsPath = "$wgScriptPath/extensions";
 }
@@ -108,6 +105,10 @@ if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
        $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
 }
 
+if ( $wgEnableParserCache === false ) {
+       $wgParserCacheType = CACHE_NONE;
+}
+
 // Fix path to icon images after they were moved in 1.24
 if ( $wgRightsIcon ) {
        $wgRightsIcon = str_replace(
@@ -362,10 +363,15 @@ if ( $wgMetaNamespace === false ) {
        $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
 }
 
-// Default value is either the suhosin limit or -1 for unlimited
+// Default value is 2000 or the suhosin limit if it is between 1 and 2000
 if ( $wgResourceLoaderMaxQueryLength === false ) {
-       $maxValueLength = ini_get( 'suhosin.get.max_value_length' );
-       $wgResourceLoaderMaxQueryLength = $maxValueLength > 0 ? $maxValueLength : -1;
+       $suhosinMaxValueLength = (int) ini_get( 'suhosin.get.max_value_length' );
+       if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
+               $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
+       } else {
+               $wgResourceLoaderMaxQueryLength = 2000;
+       }
+       unset($suhosinMaxValueLength);
 }
 
 /**
@@ -428,9 +434,9 @@ if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
 
 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
-       // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
-       $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
-       // @codingStandardsIgnoreEnd
+       MediaWiki\suppressWarnings();
+       $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
+       MediaWiki\restoreWarnings();
 }
 
 if ( $wgNewUserLog ) {
@@ -464,6 +470,15 @@ if ( $wgProfileOnly ) {
        $wgDebugLogFile = '';
 }
 
+// Backwards compatibility with old password limits
+if ( $wgMinimalPasswordLength !== false ) {
+       $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
+}
+
+if ( $wgMaximalPasswordLength !== false ) {
+       $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
+}
+
 Profiler::instance()->scopedProfileOut( $ps_default );
 
 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
@@ -483,6 +498,10 @@ require_once "$IP/includes/libs/normal/UtfNormalUtil.php";
 
 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
 
+if ( $wgScriptExtension !== '.php' || defined( 'MW_ENTRY_PHP5' ) ) {
+       wfWarn( 'Script extensions other than ".php" are deprecated.' );
+}
+
 if ( $wgCanonicalServer === false ) {
        $wgCanonicalServer = wfExpandUrl( $wgServer, PROTO_HTTP );
 }
@@ -514,15 +533,25 @@ if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
 
 // Now that GlobalFunctions is loaded, set defaults that depend on it.
 if ( $wgTmpDirectory === false ) {
-       $ps_tmpdir = Profiler::instance()->scopedProfileIn( $fname . '-tempDir' );
        $wgTmpDirectory = wfTempDir();
-       Profiler::instance()->scopedProfileOut( $ps_tmpdir );
 }
 
 // We don't use counters anymore. Left here for extensions still
 // expecting this to exist. Should be removed sometime 1.26 or later.
 $wgDisableCounters = true;
 
+if ( $wgMainWANCache === false ) {
+       // Setup a WAN cache from $wgMainCacheType with no relayer.
+       // Sites using multiple datacenters can configure a relayer.
+       $wgMainWANCache = 'mediawiki-main-default';
+       $wgWANObjectCaches[$wgMainWANCache] = array(
+               'class'         => 'WANObjectCache',
+               'cacheId'       => $wgMainCacheType,
+               'pool'          => 'mediawiki-main-default',
+               'relayerConfig' => array( 'class' => 'EventRelayerNull' )
+       );
+}
+
 Profiler::instance()->scopedProfileOut( $ps_default2 );
 
 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );
@@ -536,9 +565,9 @@ wfMemoryLimit();
  * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
  */
 if ( is_null( $wgLocaltimezone ) ) {
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $wgLocaltimezone = date_default_timezone_get();
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 }
 
 date_default_timezone_set( $wgLocaltimezone );
@@ -546,6 +575,10 @@ if ( is_null( $wgLocalTZoffset ) ) {
        $wgLocalTZoffset = date( 'Z' ) / 60;
 }
 
+if ( !$wgDBerrorLogTZ ) {
+       $wgDBerrorLogTZ = $wgLocaltimezone;
+}
+
 // Useful debug output
 if ( $wgCommandLineMode ) {
        $wgRequest = new FauxRequest( array() );
@@ -573,7 +606,6 @@ $ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' );
 $wgMemc = wfGetMainCache();
 $messageMemc = wfGetMessageCacheStorage();
 $parserMemc = wfGetParserCacheStorage();
-$wgLangConvMemc = wfGetLangConverterCacheStorage();
 
 wfDebugLog( 'caches', 'main: ' . get_class( $wgMemc ) .
        ', message: ' . get_class( $messageMemc ) .