WikiPage: Update comments related to new PreparedEdit object
[lhc/web/wiklou.git] / includes / Setup.php
index 01ba1e8..ac00fab 100644 (file)
@@ -49,6 +49,10 @@ if ( !isset( $wgVersion ) ) {
 
 mb_internal_encoding( 'UTF-8' );
 
+// Set the configured locale on all requests for consisteny
+putenv( "LC_ALL=$wgShellLocale" );
+setlocale( LC_ALL, $wgShellLocale );
+
 // Set various default paths sensibly...
 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
 
@@ -177,6 +181,20 @@ $wgLockManagers[] = [
        'class' => 'NullLockManager',
 ];
 
+/**
+ * Default parameters for the "<gallery>" tag.
+ * @see DefaultSettings.php for description of the fields.
+ */
+$wgGalleryOptions += [
+       'imagesPerRow' => 0,
+       'imageWidth' => 120,
+       'imageHeight' => 120,
+       'captionLength' => true,
+       'showBytes' => true,
+       'showDimensions' => true,
+       'mode' => 'traditional',
+];
+
 /**
  * Initialise $wgLocalFileRepo from backwards-compatible settings
  */
@@ -329,7 +347,7 @@ if ( $wgEnableEmail ) {
        $wgUseEnotif = $wgEnotifUserTalk || $wgEnotifWatchlist;
 } else {
        // Disable all other email settings automatically if $wgEnableEmail
-       // is set to false. - bug 63678
+       // is set to false. - T65678
        $wgAllowHTMLEmail = false;
        $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
        $wgEnableUserEmail = false;
@@ -403,6 +421,12 @@ if ( is_array( $wgExtraNamespaces ) ) {
        $wgCanonicalNamespaceNames = $wgCanonicalNamespaceNames + $wgExtraNamespaces;
 }
 
+// Merge in the legacy language codes, incorporating overrides from the config
+$wgDummyLanguageCodes += [
+       'qqq' => 'qqq', // Used for message documentation
+       'qqx' => 'qqx', // Used for viewing message keys
+] + $wgExtraLanguageCodes + LanguageCode::getDeprecatedCodeMapping();
+
 // These are now the same, always
 // To determine the user language, use $wgLang->getCode()
 $wgContLanguageCode = $wgLanguageCode;
@@ -521,35 +545,6 @@ if ( $wgSharedDB && $wgSharedTables ) {
 // is complete.
 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
 
-// Install a header callback to prevent caching of responses with cookies (T127993)
-if ( !$wgCommandLineMode ) {
-       header_register_callback( function () {
-               $headers = [];
-               foreach ( headers_list() as $header ) {
-                       list( $name, $value ) = explode( ':', $header, 2 );
-                       $headers[strtolower( trim( $name ) )][] = trim( $value );
-               }
-
-               if ( isset( $headers['set-cookie'] ) ) {
-                       $cacheControl = isset( $headers['cache-control'] )
-                               ? implode( ', ', $headers['cache-control'] )
-                               : '';
-
-                       if ( !preg_match( '/(?:^|,)\s*(?:private|no-cache|no-store)\s*(?:$|,)/i', $cacheControl ) ) {
-                               header( 'Expires: Thu, 01 Jan 1970 00:00:00 GMT' );
-                               header( 'Cache-Control: private, max-age=0, s-maxage=0' );
-                               MediaWiki\Logger\LoggerFactory::getInstance( 'cache-cookies' )->warning(
-                                       'Cookies set on {url} with Cache-Control "{cache-control}"', [
-                                               'url' => WebRequest::getGlobalRequestURL(),
-                                               'cookies' => $headers['set-cookie'],
-                                               'cache-control' => $cacheControl ?: '<not set>',
-                                       ]
-                               );
-                       }
-               }
-       } );
-}
-
 MWExceptionHandler::installHandler();
 
 require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
@@ -688,14 +683,19 @@ $ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' );
 
 $wgMemc = wfGetMainCache();
 $messageMemc = wfGetMessageCacheStorage();
-$parserMemc = wfGetParserCacheStorage();
+
+/**
+ * @deprecated since 1.30
+ */
+$parserMemc = new DeprecatedGlobal( 'parserMemc', function() {
+       return MediaWikiServices::getInstance()->getParserCache()->getCacheStorage();
+}, '1.30' );
 
 wfDebugLog( 'caches',
        'cluster: ' . get_class( $wgMemc ) .
        ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
        ', stash: ' . $wgMainStash .
        ', message: ' . get_class( $messageMemc ) .
-       ', parser: ' . get_class( $parserMemc ) .
        ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
 );