MediaWiki  1.30.0
Setup.php
Go to the documentation of this file.
1 <?php
27 
32 if ( !defined( 'MEDIAWIKI' ) ) {
33  exit( 1 );
34 }
35 
36 $fname = 'Setup.php';
37 $ps_setup = Profiler::instance()->scopedProfileIn( $fname );
38 
39 // Load queued extensions
40 ExtensionRegistry::getInstance()->loadFromQueue();
41 // Don't let any other extensions load
43 
44 // Check to see if we are at the file scope
45 if ( !isset( $wgVersion ) ) {
46  echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
47  die( 1 );
48 }
49 
50 mb_internal_encoding( 'UTF-8' );
51 
52 // Set the configured locale on all requests for consisteny
53 putenv( "LC_ALL=$wgShellLocale" );
54 setlocale( LC_ALL, $wgShellLocale );
55 
56 // Set various default paths sensibly...
57 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
58 
59 if ( $wgScript === false ) {
60  $wgScript = "$wgScriptPath/index.php";
61 }
62 if ( $wgLoadScript === false ) {
63  $wgLoadScript = "$wgScriptPath/load.php";
64 }
65 
66 if ( $wgArticlePath === false ) {
67  if ( $wgUsePathInfo ) {
68  $wgArticlePath = "$wgScript/$1";
69  } else {
70  $wgArticlePath = "$wgScript?title=$1";
71  }
72 }
73 
74 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
75  // 'view' is assumed the default action path everywhere in the code
76  // but is rarely filled in $wgActionPaths
78 }
79 
80 if ( $wgResourceBasePath === null ) {
82 }
83 if ( $wgStylePath === false ) {
84  $wgStylePath = "$wgResourceBasePath/skins";
85 }
86 if ( $wgLocalStylePath === false ) {
87  // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN)
88  $wgLocalStylePath = "$wgScriptPath/skins";
89 }
90 if ( $wgExtensionAssetsPath === false ) {
91  $wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
92 }
93 
94 if ( $wgLogo === false ) {
95  $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
96 }
97 
98 if ( $wgUploadPath === false ) {
99  $wgUploadPath = "$wgScriptPath/images";
100 }
101 if ( $wgUploadDirectory === false ) {
102  $wgUploadDirectory = "$IP/images";
103 }
104 if ( $wgReadOnlyFile === false ) {
105  $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
106 }
107 if ( $wgFileCacheDirectory === false ) {
108  $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
109 }
110 if ( $wgDeletedDirectory === false ) {
111  $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
112 }
113 
114 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
115  $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
116 }
117 
118 if ( $wgEnableParserCache === false ) {
120 }
121 
122 // Fix path to icon images after they were moved in 1.24
123 if ( $wgRightsIcon ) {
124  $wgRightsIcon = str_replace(
125  "{$wgStylePath}/common/images/",
126  "{$wgResourceBasePath}/resources/assets/licenses/",
128  );
129 }
130 
131 if ( isset( $wgFooterIcons['copyright']['copyright'] )
132  && $wgFooterIcons['copyright']['copyright'] === []
133 ) {
134  if ( $wgRightsIcon || $wgRightsText ) {
135  $wgFooterIcons['copyright']['copyright'] = [
136  'url' => $wgRightsUrl,
137  'src' => $wgRightsIcon,
138  'alt' => $wgRightsText,
139  ];
140  }
141 }
142 
143 if ( isset( $wgFooterIcons['poweredby'] )
144  && isset( $wgFooterIcons['poweredby']['mediawiki'] )
145  && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
146 ) {
147  $wgFooterIcons['poweredby']['mediawiki']['src'] =
148  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
149  $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
150  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
151  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
152 }
153 
162 
170 
175  'name' => 'fsLockManager',
176  'class' => 'FSLockManager',
177  'lockDirectory' => "{$wgUploadDirectory}/lockdir",
178 ];
179 $wgLockManagers[] = [
180  'name' => 'nullLockManager',
181  'class' => 'NullLockManager',
182 ];
183 
189  'imagesPerRow' => 0,
190  'imageWidth' => 120,
191  'imageHeight' => 120,
192  'captionLength' => true,
193  'showBytes' => true,
194  'showDimensions' => true,
195  'mode' => 'traditional',
196 ];
197 
201 if ( !$wgLocalFileRepo ) {
202  $wgLocalFileRepo = [
203  'class' => 'LocalRepo',
204  'name' => 'local',
205  'directory' => $wgUploadDirectory,
206  'scriptDirUrl' => $wgScriptPath,
207  'scriptExtension' => '.php',
209  'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
210  'thumbScriptUrl' => $wgThumbnailScriptPath,
211  'transformVia404' => !$wgGenerateThumbnailOnParse,
212  'deletedDir' => $wgDeletedDirectory,
213  'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
214  ];
215 }
219 if ( $wgUseSharedUploads ) {
220  if ( $wgSharedUploadDBname ) {
221  $wgForeignFileRepos[] = [
222  'class' => 'ForeignDBRepo',
223  'name' => 'shared',
224  'directory' => $wgSharedUploadDirectory,
225  'url' => $wgSharedUploadPath,
226  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
227  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
228  'transformVia404' => !$wgGenerateThumbnailOnParse,
229  'dbType' => $wgDBtype,
230  'dbServer' => $wgDBserver,
231  'dbUser' => $wgDBuser,
232  'dbPassword' => $wgDBpassword,
233  'dbName' => $wgSharedUploadDBname,
234  'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
235  'tablePrefix' => $wgSharedUploadDBprefix,
236  'hasSharedCache' => $wgCacheSharedUploads,
237  'descBaseUrl' => $wgRepositoryBaseUrl,
238  'fetchDescription' => $wgFetchCommonsDescriptions,
239  ];
240  } else {
241  $wgForeignFileRepos[] = [
242  'class' => 'FileRepo',
243  'name' => 'shared',
244  'directory' => $wgSharedUploadDirectory,
245  'url' => $wgSharedUploadPath,
246  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
247  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
248  'transformVia404' => !$wgGenerateThumbnailOnParse,
249  'descBaseUrl' => $wgRepositoryBaseUrl,
250  'fetchDescription' => $wgFetchCommonsDescriptions,
251  ];
252  }
253 }
254 if ( $wgUseInstantCommons ) {
255  $wgForeignFileRepos[] = [
256  'class' => 'ForeignAPIRepo',
257  'name' => 'wikimediacommons',
258  'apibase' => 'https://commons.wikimedia.org/w/api.php',
259  'url' => 'https://upload.wikimedia.org/wikipedia/commons',
260  'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
261  'hashLevels' => 2,
262  'transformVia404' => true,
263  'fetchDescription' => true,
264  'descriptionCacheExpiry' => 43200,
265  'apiThumbCacheExpiry' => 0,
266  ];
267 }
268 /*
269  * Add on default file backend config for file repos.
270  * FileBackendGroup will handle initializing the backends.
271  */
272 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
273  $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
274 }
275 foreach ( $wgForeignFileRepos as &$repo ) {
276  if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
277  $repo['directory'] = $wgUploadDirectory; // b/c
278  }
279  if ( !isset( $repo['backend'] ) ) {
280  $repo['backend'] = $repo['name'] . '-backend';
281  }
282 }
283 unset( $repo ); // no global pollution; destroy reference
284 
285 // Convert this deprecated setting to modern system
286 if ( $wgExperimentalHtmlIds ) {
287  $wgFragmentMode = [ 'html5-legacy', 'legacy' ];
288 }
289 
290 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
291 if ( $wgRCFilterByAge ) {
292  // Trim down $wgRCLinkDays so that it only lists links which are valid
293  // as determined by $wgRCMaxAge.
294  // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
295  sort( $wgRCLinkDays );
296 
297  // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
298  for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
299  // @codingStandardsIgnoreEnd
300  if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
301  $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
302  break;
303  }
304  }
305 }
306 // Ensure that default user options are not invalid, since that breaks Special:Preferences
307 $wgDefaultUserOptions['rcdays'] = min(
308  $wgDefaultUserOptions['rcdays'],
309  ceil( $rcMaxAgeDays )
310 );
311 $wgDefaultUserOptions['watchlistdays'] = min(
312  $wgDefaultUserOptions['watchlistdays'],
313  ceil( $rcMaxAgeDays )
314 );
315 unset( $rcMaxAgeDays );
316 
317 if ( $wgSkipSkin ) {
319 }
320 
321 $wgSkipSkins[] = 'fallback';
322 $wgSkipSkins[] = 'apioutput';
323 
324 if ( $wgLocalInterwiki ) {
325  array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
326 }
327 
328 // Set default shared prefix
329 if ( $wgSharedPrefix === false ) {
331 }
332 
333 // Set default shared schema
334 if ( $wgSharedSchema === false ) {
336 }
337 
338 if ( !$wgCookiePrefix ) {
339  if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
341  } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
343  } elseif ( $wgDBprefix ) {
345  } else {
347  }
348 }
349 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
350 
351 if ( $wgEnableEmail ) {
353 } else {
354  // Disable all other email settings automatically if $wgEnableEmail
355  // is set to false. - T65678
356  $wgAllowHTMLEmail = false;
357  $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
367  unset( $wgGroupPermissions['user']['sendemail'] );
368  $wgUseEnotif = false;
371 }
372 
373 if ( $wgMetaNamespace === false ) {
374  $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
375 }
376 
377 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
378 if ( $wgResourceLoaderMaxQueryLength === false ) {
379  $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
380  if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
381  $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
382  } else {
384  }
385  unset( $suhosinMaxValueLength );
386 }
387 
388 // Ensure the minimum chunk size is less than PHP upload limits or the maximum
389 // upload size.
392  UploadBase::getMaxUploadSize( 'file' ),
393  UploadBase::getMaxPhpUploadSize(),
395  ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
396  PHP_INT_MAX
397  ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
398 );
399 
405  NS_MEDIA => 'Media',
406  NS_SPECIAL => 'Special',
407  NS_TALK => 'Talk',
408  NS_USER => 'User',
409  NS_USER_TALK => 'User_talk',
410  NS_PROJECT => 'Project',
411  NS_PROJECT_TALK => 'Project_talk',
412  NS_FILE => 'File',
413  NS_FILE_TALK => 'File_talk',
414  NS_MEDIAWIKI => 'MediaWiki',
415  NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
416  NS_TEMPLATE => 'Template',
417  NS_TEMPLATE_TALK => 'Template_talk',
418  NS_HELP => 'Help',
419  NS_HELP_TALK => 'Help_talk',
420  NS_CATEGORY => 'Category',
421  NS_CATEGORY_TALK => 'Category_talk',
422 ];
423 
425 if ( is_array( $wgExtraNamespaces ) ) {
427 }
428 
429 // Merge in the legacy language codes, incorporating overrides from the config
431  'qqq' => 'qqq', // Used for message documentation
432  'qqx' => 'qqx', // Used for viewing message keys
434 
435 // These are now the same, always
436 // To determine the user language, use $wgLang->getCode()
438 
439 // Easy to forget to falsify $wgDebugToolbar for static caches.
440 // If file cache or CDN cache is on, just disable this (DWIMD).
441 if ( $wgUseFileCache || $wgUseSquid ) {
442  $wgDebugToolbar = false;
443 }
444 
445 // We always output HTML5 since 1.22, overriding these is no longer supported
446 // we set them here for extensions that depend on its value.
447 $wgHtml5 = true;
448 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
449 $wgJsMimeType = 'text/javascript';
450 
451 // Blacklisted file extensions shouldn't appear on the "allowed" list
452 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
453 
455  MediaWiki\suppressWarnings();
456  $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
457  MediaWiki\restoreWarnings();
458 }
459 
460 if ( $wgNewUserLog ) {
461  // Add a new log type
462  $wgLogTypes[] = 'newusers';
463  $wgLogNames['newusers'] = 'newuserlogpage';
464  $wgLogHeaders['newusers'] = 'newuserlogpagetext';
465  $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
466  $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
467  $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
468  $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
469  $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
470 }
471 
472 if ( $wgPageLanguageUseDB ) {
473  $wgLogTypes[] = 'pagelang';
474  $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
475 }
476 
477 if ( $wgCookieSecure === 'detect' ) {
478  $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
479 }
480 
481 if ( $wgProfileOnly ) {
482  $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
483  $wgDebugLogFile = '';
484 }
485 
486 // Backwards compatibility with old password limits
487 if ( $wgMinimalPasswordLength !== false ) {
488  $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
489 }
490 
491 if ( $wgMaximalPasswordLength !== false ) {
492  $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
493 }
494 
495 // Backwards compatibility warning
496 if ( !$wgSessionsInObjectCache ) {
497  wfDeprecated( '$wgSessionsInObjectCache = false', '1.27' );
498  if ( $wgSessionHandler ) {
499  wfDeprecated( '$wgSessionsHandler', '1.27' );
500  }
501  $cacheType = get_class( ObjectCache::getInstance( $wgSessionCacheType ) );
502  wfDebugLog(
503  'caches',
504  "Session data will be stored in \"$cacheType\" cache with " .
505  "expiry $wgObjectCacheSessionExpiry seconds"
506  );
507 }
509 
510 if ( $wgPHPSessionHandling !== 'enable' &&
511  $wgPHPSessionHandling !== 'warn' &&
512  $wgPHPSessionHandling !== 'disable'
513 ) {
514  $wgPHPSessionHandling = 'warn';
515 }
516 if ( defined( 'MW_NO_SESSION' ) ) {
517  // If the entry point wants no session, force 'disable' here unless they
518  // specifically set it to the (undocumented) 'warn'.
519  $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
520 }
521 
522 Profiler::instance()->scopedProfileOut( $ps_default );
523 
524 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
525 // all the memory from logging SQL queries on maintenance scripts
528  MWDebug::init();
529 }
530 
531 // Reset the global service locator, so any services that have already been created will be
532 // re-created while taking into account any custom settings and extensions.
533 MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
534 
535 if ( $wgSharedDB && $wgSharedTables ) {
536  // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
537  MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
538  array_fill_keys(
540  [
541  'dbname' => $wgSharedDB,
542  'schema' => $wgSharedSchema,
543  'prefix' => $wgSharedPrefix
544  ]
545  )
546  );
547 }
548 
549 // Define a constant that indicates that the bootstrapping of the service locator
550 // is complete.
551 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
552 
554 
555 require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
556 
557 $ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
558 
559 // T48998: Bail out early if $wgArticlePath is non-absolute
560 foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) {
561  if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
562  throw new FatalError(
563  "If you use a relative URL for \$$varName, it must start " .
564  'with a slash (<code>/</code>).<br><br>See ' .
565  "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
566  "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
567  );
568  }
569 }
570 
571 Profiler::instance()->scopedProfileOut( $ps_validation );
572 
573 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
574 
575 if ( $wgCanonicalServer === false ) {
577 }
578 
579 // Set server name
581 if ( $wgServerName !== false ) {
582  wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
583  . 'not customized. Overwriting $wgServerName.' );
584 }
586 unset( $serverParts );
587 
588 // Set defaults for configuration variables
589 // that are derived from the server name by default
590 // Note: $wgEmergencyContact and $wgPasswordSender may be false or empty string (T104142)
591 if ( !$wgEmergencyContact ) {
592  $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
593 }
594 if ( !$wgPasswordSender ) {
595  $wgPasswordSender = 'apache@' . $wgServerName;
596 }
597 if ( !$wgNoReplyAddress ) {
599 }
600 
601 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
602  $wgSecureLogin = false;
603  wfWarn( 'Secure login was enabled on a server that only supports '
604  . 'HTTP or HTTPS. Disabling secure login.' );
605 }
606 
608 
609 // Now that GlobalFunctions is loaded, set defaults that depend on it.
610 if ( $wgTmpDirectory === false ) {
612 }
613 
614 // We don't use counters anymore. Left here for extensions still
615 // expecting this to exist. Should be removed sometime 1.26 or later.
616 if ( !isset( $wgDisableCounters ) ) {
617  $wgDisableCounters = true;
618 }
619 
620 if ( $wgMainWANCache === false ) {
621  // Setup a WAN cache from $wgMainCacheType with no relayer.
622  // Sites using multiple datacenters can configure a relayer.
623  $wgMainWANCache = 'mediawiki-main-default';
625  'class' => 'WANObjectCache',
626  'cacheId' => $wgMainCacheType,
627  'channels' => [ 'purge' => 'wancache-main-default-purge' ]
628  ];
629 }
630 
631 Profiler::instance()->scopedProfileOut( $ps_default2 );
632 
633 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );
634 
635 // Raise the memory limit if it's too low
636 wfMemoryLimit();
637 
643 if ( is_null( $wgLocaltimezone ) ) {
644  MediaWiki\suppressWarnings();
645  $wgLocaltimezone = date_default_timezone_get();
646  MediaWiki\restoreWarnings();
647 }
648 
649 date_default_timezone_set( $wgLocaltimezone );
650 if ( is_null( $wgLocalTZoffset ) ) {
651  $wgLocalTZoffset = date( 'Z' ) / 60;
652 }
653 // The part after the System| is ignored, but rest of MW fills it
654 // out as the local offset.
655 $wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
656 
657 if ( !$wgDBerrorLogTZ ) {
659 }
660 
661 // initialize the request object in $wgRequest
662 $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
663 // Set user IP/agent information for causal consistency purposes
664 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
665  'IPAddress' => $wgRequest->getIP(),
666  'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
667  'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' )
668 ] );
669 
670 // Useful debug output
671 if ( $wgCommandLineMode ) {
672  wfDebug( "\n\nStart command line script $self\n" );
673 } else {
674  $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
675 
676  if ( $wgDebugPrintHttpHeaders ) {
677  $debug .= "HTTP HEADERS:\n";
678 
679  foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
680  $debug .= "$name: $value\n";
681  }
682  }
683  wfDebug( $debug );
684 }
685 
686 Profiler::instance()->scopedProfileOut( $ps_misc );
687 $ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' );
688 
691 
695 $parserMemc = new DeprecatedGlobal( 'parserMemc', function () {
696  return MediaWikiServices::getInstance()->getParserCache()->getCacheStorage();
697 }, '1.30' );
698 
699 wfDebugLog( 'caches',
700  'cluster: ' . get_class( $wgMemc ) .
701  ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
702  ', stash: ' . $wgMainStash .
703  ', message: ' . get_class( $messageMemc ) .
704  ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
705 );
706 
707 Profiler::instance()->scopedProfileOut( $ps_memcached );
708 
709 // Most of the config is out, some might want to run hooks here.
710 Hooks::run( 'SetupAfterCache' );
711 
712 $ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
713 
718 $wgContLang->initContLang();
719 
720 // Now that variant lists may be available...
721 $wgRequest->interpolateTitle();
722 
723 if ( !is_object( $wgAuth ) ) {
725  Hooks::run( 'AuthPluginSetup', [ &$wgAuth ] );
726 }
727 if ( $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin ) {
728  MediaWiki\Auth\AuthManager::singleton()->forcePrimaryAuthenticationProviders( [
729  new MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider( [
730  'authoritative' => false,
731  ] ),
732  new MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider( $wgAuth ),
733  new MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider( [
734  'authoritative' => true,
735  ] ),
736  ], '$wgAuth is ' . get_class( $wgAuth ) );
737 }
738 
739 // Set up the session
740 $ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
746 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
747  // If session.auto_start is there, we can't touch session name
748  if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
749  session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
750  }
751 
752  // Create the SessionManager singleton and set up our session handler,
753  // unless we're specifically asked not to.
754  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
756  MediaWiki\Session\SessionManager::singleton()
757  );
758  }
759 
760  // Initialize the session
761  try {
763  } catch ( OverflowException $ex ) {
764  if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
765  // The exception is because the request had multiple possible
766  // sessions tied for top priority. Report this to the user.
767  $list = [];
768  foreach ( $ex->sessionInfos as $info ) {
769  $list[] = $info->getProvider()->describe( $wgContLang );
770  }
771  $list = $wgContLang->listToText( $list );
772  throw new HttpError( 400,
773  Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )->plain()
774  );
775  }
776 
777  // Not the one we want, rethrow
778  throw $ex;
779  }
780 
781  if ( $session->isPersistent() ) {
782  $wgInitialSessionId = $session->getSessionId();
783  }
784 
785  $session->renew();
786  if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
787  ( $session->isPersistent() || $session->shouldRememberUser() )
788  ) {
789  // Start the PHP-session for backwards compatibility
790  session_id( $session->getId() );
791  MediaWiki\quietCall( 'session_start' );
792  }
793 
794  unset( $session );
795 } else {
796  // Even if we didn't set up a global Session, still install our session
797  // handler unless specifically requested not to.
798  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
800  MediaWiki\Session\SessionManager::singleton()
801  );
802  }
803 }
804 Profiler::instance()->scopedProfileOut( $ps_session );
805 
809 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
810 
815 
819 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
820 
824 $wgParser = new StubObject( 'wgParser', function () {
825  return MediaWikiServices::getInstance()->getParser();
826 } );
827 
831 $wgTitle = null;
832 
833 Profiler::instance()->scopedProfileOut( $ps_globals );
834 $ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
835 
836 // Extension setup functions
837 // Entries should be added to this variable during the inclusion
838 // of the extension file. This allows the extension to perform
839 // any necessary initialisation in the fully initialised environment
840 foreach ( $wgExtensionFunctions as $func ) {
841  // Allow closures in PHP 5.3+
842  if ( is_object( $func ) && $func instanceof Closure ) {
843  $profName = $fname . '-extensions-closure';
844  } elseif ( is_array( $func ) ) {
845  if ( is_object( $func[0] ) ) {
846  $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
847  } else {
848  $profName = $fname . '-extensions-' . implode( '::', $func );
849  }
850  } else {
851  $profName = $fname . '-extensions-' . strval( $func );
852  }
853 
854  $ps_ext_func = Profiler::instance()->scopedProfileIn( $profName );
855  call_user_func( $func );
856  Profiler::instance()->scopedProfileOut( $ps_ext_func );
857 }
858 
859 // If the session user has a 0 id but a valid name, that means we need to
860 // autocreate it.
861 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
862  $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
863  if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
864  $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
865  $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
866  $sessionUser,
867  MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
868  true
869  );
870  Profiler::instance()->scopedProfileOut( $ps_autocreate );
871  \MediaWiki\Logger\LoggerFactory::getInstance( 'authevents' )->info( 'Autocreation attempt', [
872  'event' => 'autocreate',
873  'status' => $res,
874  ] );
875  unset( $res );
876  }
877  unset( $sessionUser );
878 }
879 
880 if ( !$wgCommandLineMode ) {
882 }
883 
885 
886 Profiler::instance()->scopedProfileOut( $ps_extensions );
887 Profiler::instance()->scopedProfileOut( $ps_setup );
$wgCanonicalNamespaceNames
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
Definition: Setup.php:404
$wgLocalInterwiki
$wgLocalInterwiki
The interwiki prefix of the current wiki, or false if it doesn't have one.
Definition: DefaultSettings.php:3957
LanguageCode\getDeprecatedCodeMapping
static getDeprecatedCodeMapping()
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up...
Definition: LanguageCode.php:63
$ps_session
if(!is_object( $wgAuth)) if( $wgAuth &&! $wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin) $ps_session
Definition: Setup.php:740
$wgUser
$wgUser
Definition: Setup.php:809
MediaWiki\Session\PHPSessionHandler\install
static install(SessionManager $manager)
Install a session handler for the current web request.
Definition: PHPSessionHandler.php:108
$wgUsersNotifiedOnAllChanges
$wgUsersNotifiedOnAllChanges
Definition: Setup.php:370
$wgMaximalPasswordLength
$wgMaximalPasswordLength
Specifies the maximal length of a user password (T64685).
Definition: DefaultSettings.php:4748
MW_NO_SESSION
const MW_NO_SESSION
Definition: load.php:30
$wgDBserver
$wgDBserver
Database host name or IP address.
Definition: DefaultSettings.php:1772
$wgFileBlacklist
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
Definition: DefaultSettings.php:874
$wgActionPaths
$wgActionPaths
Definition: img_auth.php:46
NS_HELP
const NS_HELP
Definition: Defines.php:77
$wgRCLinkDays
$wgRCLinkDays
List of Days options to list in the Special:Recentchanges and Special:Recentchangeslinked pages.
Definition: DefaultSettings.php:6717
$wgResourceLoaderMaxQueryLength
$wgResourceLoaderMaxQueryLength
If set to a positive number, ResourceLoader will not generate URLs whose query string is more than th...
Definition: DefaultSettings.php:3749
$wgProfileOnly
$wgProfileOnly
Don't put non-profiling info into log file.
Definition: DefaultSettings.php:6318
$wgNamespaceProtection
if( $wgScript===false) if( $wgLoadScript===false) if( $wgArticlePath===false) if(!empty( $wgActionPaths) &&!isset( $wgActionPaths['view'])) if( $wgResourceBasePath===null) if( $wgStylePath===false) if( $wgLocalStylePath===false) if( $wgExtensionAssetsPath===false) if( $wgLogo===false) if( $wgUploadPath===false) if( $wgUploadDirectory===false) if( $wgReadOnlyFile===false) if( $wgFileCacheDirectory===false) if( $wgDeletedDirectory===false) if( $wgGitInfoCacheDirectory===false && $wgCacheDirectory !==false) if( $wgEnableParserCache===false) if( $wgRightsIcon) if(isset( $wgFooterIcons['copyright']['copyright']) && $wgFooterIcons['copyright']['copyright']===[]) if(isset( $wgFooterIcons['poweredby']) &&isset( $wgFooterIcons['poweredby']['mediawiki']) && $wgFooterIcons['poweredby']['mediawiki']['src']===null) $wgNamespaceProtection[NS_MEDIAWIKI]
Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgName...
Definition: Setup.php:161
$wgExperimentalHtmlIds
$wgExperimentalHtmlIds
Abandoned experiment with HTML5-style ID escaping.
Definition: DefaultSettings.php:3362
$wgCookiePrefix
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:349
$wgMinUploadChunkSize
if( $wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Definition: Setup.php:390
$wgParser
$wgParser
Definition: Setup.php:824
$wgEnotifFromEditor
$wgEnotifFromEditor
Definition: Setup.php:359
$wgInvalidateCacheOnLocalSettingsChange
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
Definition: DefaultSettings.php:2617
$wgGalleryOptions
$wgGalleryOptions
Default parameters for the "<gallery>" tag.
Definition: Setup.php:188
$wgTmpDirectory
$wgTmpDirectory
The local filesystem path to a temporary directory.
Definition: DefaultSettings.php:334
$wgRightsText
$wgRightsText
If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link.
Definition: DefaultSettings.php:7035
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:62
$wgEnotifWatchlist
$wgEnotifWatchlist
Definition: Setup.php:366
$wgSharedTables
$wgSharedTables
Definition: DefaultSettings.php:1909
$wgSharedSchema
$wgSharedSchema
Definition: DefaultSettings.php:1915
StubObject
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Definition: StubObject.php:44
$wgFileExtensions
$wgFileExtensions
Definition: Setup.php:452
NS_TEMPLATE_TALK
const NS_TEMPLATE_TALK
Definition: Defines.php:76
$wgLogHeaders
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type.
Definition: DefaultSettings.php:7652
captcha-old.count
count
Definition: captcha-old.py:249
$wgDefaultUserOptions
if( $wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
Definition: Setup.php:307
$wgUserEmailUseReplyTo
$wgUserEmailUseReplyTo
Definition: Setup.php:369
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:202
MediaWiki\Logger\LoggerFactory\getInstance
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
Definition: LoggerFactory.php:92
CACHE_NONE
const CACHE_NONE
Definition: Defines.php:103
$ps_misc
$ps_misc
Definition: Setup.php:633
$wgDBtype
$wgDBtype
Database type.
Definition: DefaultSettings.php:1797
MediaWiki\Auth\AuthManagerAuthPlugin
Backwards-compatibility wrapper for AuthManager via $wgAuth.
Definition: AuthManagerAuthPlugin.php:30
$wgSharedDB
$wgSharedDB
Shared database for multiple wikis.
Definition: DefaultSettings.php:1899
$wgLocalFileRepo
$wgLocalFileRepo
File repository structures.
Definition: DefaultSettings.php:517
$ps_memcached
$ps_memcached
Definition: Setup.php:687
$wgWANObjectCaches
$wgWANObjectCaches
Advanced WAN object cache configuration.
Definition: DefaultSettings.php:2357
$wgLang
$wgLang
Definition: Setup.php:814
$wgVersion
$wgVersion
MediaWiki version number.
Definition: DefaultSettings.php:78
$wgHtml5
if( $wgUseFileCache|| $wgUseSquid) $wgHtml5
Definition: Setup.php:447
$wgSharedUploadDBprefix
$wgSharedUploadDBprefix
Optional table prefix used in database.
Definition: DefaultSettings.php:717
DBO_DEBUG
const DBO_DEBUG
Definition: defines.php:9
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$wgContLanguageCode
$wgContLanguageCode
Definition: Setup.php:437
$wgDBmwschema
$wgDBmwschema
Mediawiki schema.
Definition: DefaultSettings.php:1867
$wgVirtualRestConfig
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//') $wgVirtualRestConfig['global']['domain']
Definition: Setup.php:607
$wgGenerateThumbnailOnParse
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
Definition: DefaultSettings.php:1229
$wgEnableUserEmail
$wgEnableUserEmail
Definition: Setup.php:358
$fname
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:36
$wgUseSharedUploads
$wgUseSharedUploads
If you operate multiple wikis, you can define a shared upload path here.
Definition: DefaultSettings.php:691
NS_FILE
const NS_FILE
Definition: Defines.php:71
$wgExtensionAssetsPath
$wgExtensionAssetsPath
The URL path of the extensions directory.
Definition: DefaultSettings.php:232
NS_TEMPLATE
const NS_TEMPLATE
Definition: Defines.php:75
MWExceptionHandler\installHandler
static installHandler()
Install handlers with PHP.
Definition: MWExceptionHandler.php:53
WebRequest\detectProtocol
static detectProtocol()
Detect the protocol from $_SERVER.
Definition: WebRequest.php:243
$wgUseSquid
$wgUseSquid
Enable/disable CDN.
Definition: DefaultSettings.php:2655
$wgFragmentMode
$wgFragmentMode
How should section IDs be encoded? This array can contain 1 or 2 elements, each of them can be one of...
Definition: DefaultSettings.php:3394
$wgHashedSharedUploadDirectory
$wgHashedSharedUploadDirectory
Set the following to false especially if you have a set of files that need to be accessible by all wi...
Definition: DefaultSettings.php:847
$res
$res
Definition: database.txt:21
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
$wgCacheDirectory
$wgCacheDirectory
Directory for caching data in the local filesystem.
Definition: DefaultSettings.php:2227
User\isValidUserName
static isValidUserName( $name)
Is the input a valid username?
Definition: User.php:851
$wgLogo
$wgLogo
The URL path of the wiki logo.
Definition: DefaultSettings.php:278
$wgEnableParserCache
$wgEnableParserCache
Kept for extension compatibility; see $wgParserCacheType.
Definition: DefaultSettings.php:2568
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1140
$wgMetaNamespace
$wgMetaNamespace
Name of the project namespace.
Definition: DefaultSettings.php:3856
HttpError
Show an error that looks like an HTTP server error.
Definition: HttpError.php:30
$wgDBpassword
$wgDBpassword
Database user's password.
Definition: DefaultSettings.php:1792
$wgDBprefix
$wgDBprefix
Table name prefix.
Definition: DefaultSettings.php:1849
$wgStylePath
$wgStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:217
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$wgMemc
$wgMemc
Definition: Setup.php:689
$debug
$debug
Definition: mcc.php:31
$wgRepositoryBaseUrl
$wgRepositoryBaseUrl
Base URL for a repository wiki.
Definition: DefaultSettings.php:857
$wgUseInstantCommons
$wgUseInstantCommons
Use Commons as a remote file repository.
Definition: DefaultSettings.php:529
ExtensionRegistry\getInstance
static getInstance()
Definition: ExtensionRegistry.php:80
$wgHashedUploadDirectory
$wgHashedUploadDirectory
Set this to false if you do not want MediaWiki to divide your images directory into many subdirectori...
Definition: DefaultSettings.php:840
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:54
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:866
$wgNoReplyAddress
$wgNoReplyAddress
Reply-To address for e-mail notifications.
Definition: DefaultSettings.php:1591
wfGetMainCache
wfGetMainCache()
Get the main cache object.
Definition: GlobalFunctions.php:3204
$wgEnotifMaxRecips
$wgEnotifMaxRecips
Definition: Setup.php:361
$wgSharedUploadPath
$wgSharedUploadPath
Full path on the web server where shared uploads can be found.
Definition: DefaultSettings.php:696
NS_PROJECT
const NS_PROJECT
Definition: Defines.php:69
$wgDBname
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned $wgDBname
Definition: memcached.txt:96
$wgEmergencyContact
$wgEmergencyContact
Site admin email address.
Definition: DefaultSettings.php:1568
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1176
$wgFooterIcons
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
Definition: DefaultSettings.php:3436
$ps_default
$ps_default
Definition: Setup.php:57
$wgUseFileCache
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
Definition: DefaultSettings.php:2554
$wgCommandLineMode
global $wgCommandLineMode
Definition: Setup.php:526
$ps_validation
$ps_validation
Definition: Setup.php:557
$parserMemc
$parserMemc
Definition: Setup.php:695
NS_MEDIAWIKI_TALK
const NS_MEDIAWIKI_TALK
Definition: Defines.php:74
$wgDebugLogGroups
$wgDebugLogGroups
Map of string log group names to log destinations.
Definition: DefaultSettings.php:6201
$wgEnotifUserTalk
$wgEnotifUserTalk
Definition: Setup.php:365
$wgLoadScript
$wgLoadScript
The URL path to load.php.
Definition: DefaultSettings.php:210
MediaWiki
A helper class for throttling authentication attempts.
$wgSharedPrefix
$wgSharedPrefix
Definition: DefaultSettings.php:1904
ObjectCache\getInstance
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:92
$wgFetchCommonsDescriptions
$wgFetchCommonsDescriptions
Fetch commons image description pages and display them on the local wiki?
Definition: DefaultSettings.php:701
$wgLogTypes
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
Definition: DefaultSettings.php:7568
$wgParserCacheType
$wgParserCacheType
The cache type for storing article HTML.
Definition: DefaultSettings.php:2262
$wgEnotifUseRealName
$wgEnotifUseRealName
Definition: Setup.php:364
$wgEnableEmail
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
Definition: DefaultSettings.php:1598
GlobalVarConfig
Accesses configuration settings from $GLOBALS.
Definition: GlobalVarConfig.php:28
$wgSessionName
$wgSessionName
Override to customise the session name.
Definition: DefaultSettings.php:6042
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:79
wfMemoryLimit
wfMemoryLimit()
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
Definition: GlobalFunctions.php:3086
$wgDebugLogFile
$wgDebugLogFile
Filename for debug logging.
Definition: DefaultSettings.php:6083
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:1047
$wgDummyLanguageCodes
if(is_array( $wgExtraNamespaces)) $wgDummyLanguageCodes
Definition: Setup.php:430
$wgCanonicalServer
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
Definition: DefaultSettings.php:118
$wgSkipSkin
$wgSkipSkin
Definition: DefaultSettings.php:3278
$wgEnotifRevealEditorAddress
$wgEnotifRevealEditorAddress
Definition: Setup.php:363
$wgLockManagers
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
Definition: Setup.php:174
$wgCacheSharedUploads
$wgCacheSharedUploads
Cache shared metadata in memcached.
Definition: DefaultSettings.php:723
$wgFullyInitialised
foreach( $wgExtensionFunctions as $func) if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised
Definition: Setup.php:884
$wgPageLanguageUseDB
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
Definition: DefaultSettings.php:8558
$ps_default2
$ps_default2
Definition: Setup.php:573
$wgEnotifMinorEdits
$wgEnotifMinorEdits
Definition: Setup.php:362
MediaWiki\Session\SessionManager\getGlobalSession
static getGlobalSession()
Get the "global" session.
Definition: SessionManager.php:106
$wgTitle
$wgTitle
Definition: Setup.php:831
$wgSessionHandler
$wgSessionHandler
Definition: DefaultSettings.php:2420
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:68
$wgDebugPrintHttpHeaders
$wgDebugPrintHttpHeaders
Print HTTP headers for every request in the debug information.
Definition: DefaultSettings.php:6244
$messageMemc
$messageMemc
Definition: Setup.php:690
$value
$value
Definition: styleTest.css.php:45
$wgLocalTZoffset
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
Definition: DefaultSettings.php:3142
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:53
$wgNamespaceAliases
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
Definition: Setup.php:168
$wgLocalInterwikis
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
Definition: DefaultSettings.php:3967
$wgDeletedDirectory
$wgDeletedDirectory
What directory to place deleted uploads in.
Definition: DefaultSettings.php:413
StubUserLang
Stub object for the user language.
Definition: StubObject.php:177
$wgServer
$wgServer
URL of the server.
Definition: DefaultSettings.php:109
DeprecatedGlobal
Class to allow throwing wfDeprecated warnings when people use globals that we do not want them to.
Definition: DeprecatedGlobal.php:27
$wgRCMaxAge
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go.
Definition: DefaultSettings.php:6681
$wgLanguageCode
$wgLanguageCode
Site language code.
Definition: DefaultSettings.php:2861
$rcMaxAgeDays
if( $wgExperimentalHtmlIds) $rcMaxAgeDays
Definition: Setup.php:290
$wgSitename
$wgSitename
Name of the site.
Definition: DefaultSettings.php:83
$wgRightsIcon
$wgRightsIcon
Override for copyright metadata.
Definition: DefaultSettings.php:7040
PROTO_HTTP
const PROTO_HTTP
Definition: Defines.php:220
$wgJsMimeType
$wgJsMimeType
Definition: Setup.php:449
NS_PROJECT_TALK
const NS_PROJECT_TALK
Definition: Defines.php:70
MWDebug\init
static init()
Enabled the debugger and load resource module.
Definition: MWDebug.php:76
$wgExtensionFunctions
$wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
Definition: DefaultSettings.php:7163
$wgSessionsInObjectCache
if( $wgInvalidateCacheOnLocalSettingsChange) if( $wgNewUserLog) if( $wgPageLanguageUseDB) if( $wgCookieSecure==='detect') if( $wgProfileOnly) if( $wgMinimalPasswordLength !==false) if( $wgMaximalPasswordLength !==false) if(! $wgSessionsInObjectCache) $wgSessionsInObjectCache
Definition: Setup.php:508
$wgEmailAuthentication
$wgEmailAuthentication
Definition: Setup.php:357
$wgUploadBaseUrl
$wgUploadBaseUrl
If set, this URL is added to the start of $wgUploadPath to form a complete upload URL.
Definition: DefaultSettings.php:341
$wgUploadDirectory
$wgUploadDirectory
The filesystem path of the images directory.
Definition: DefaultSettings.php:266
$wgAllowHTMLEmail
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
Definition: DefaultSettings.php:1680
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:470
$wgLogActionsHandlers
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
Definition: DefaultSettings.php:7680
wfIniGetBool
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
Definition: GlobalFunctions.php:2222
plain
either a plain
Definition: hooks.txt:2026
$wgResourceBasePath
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
Definition: DefaultSettings.php:3639
$serverParts
if( $wgCanonicalServer===false) $serverParts
Definition: Setup.php:580
$wgUseEnotif
$wgUseEnotif
Definition: Setup.php:368
$wgSessionCacheType
$wgSessionCacheType
The cache type for storing session data.
Definition: DefaultSettings.php:2269
$wgArticlePath
$wgArticlePath
Definition: img_auth.php:45
$ps_setup
$ps_setup
Definition: Setup.php:37
wfGetMessageCacheStorage
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
Definition: GlobalFunctions.php:3214
$wgCacheEpoch
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
Definition: DefaultSettings.php:2532
wfShorthandToInteger
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:3135
$wgGitInfoCacheDirectory
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
Definition: DefaultSettings.php:2538
$wgXhtmlDefaultNamespace
$wgXhtmlDefaultNamespace
Definition: Setup.php:448
$wgSharedUploadDBname
$wgSharedUploadDBname
DB name with metadata about shared directory.
Definition: DefaultSettings.php:712
wfTempDir
wfTempDir()
Tries to get the system directory for temporary files.
Definition: GlobalFunctions.php:2107
$wgSharedUploadDirectory
$wgSharedUploadDirectory
Path on the file system where shared uploads can be found.
Definition: DefaultSettings.php:706
$wgReadOnlyFile
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode.
Definition: DefaultSettings.php:6631
$wgSkipSkins
if( $wgSkipSkin) $wgSkipSkins[]
Definition: Setup.php:321
NS_HELP_TALK
const NS_HELP_TALK
Definition: Defines.php:78
MediaWiki\Auth\AuthManager\singleton
static singleton()
Get the global AuthManager.
Definition: AuthManager.php:146
$wgThumbnailScriptPath
$wgThumbnailScriptPath
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating t...
Definition: DefaultSettings.php:820
$wgGroupPermissions
$wgGroupPermissions
Permission keys given to users in each group.
Definition: DefaultSettings.php:5129
FatalError
Exception class which takes an HTML error message, and does not produce a backtrace.
Definition: FatalError.php:28
$wgLocaltimezone
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
Definition: DefaultSettings.php:3131
$wgEnotifImpersonal
$wgEnotifImpersonal
Definition: Setup.php:360
$wgMainCacheType
CACHE_MEMCACHED $wgMainCacheType
Definition: memcached.txt:63
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$wgCookieSecure
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
Definition: DefaultSettings.php:6010
$ps_globals
$ps_globals
Definition: Setup.php:712
$wgShellLocale
$wgShellLocale
Locale for LC_ALL, to provide a known environment for locale-sensitive operations.
Definition: DefaultSettings.php:8247
NS_USER
const NS_USER
Definition: Defines.php:67
$ps_extensions
$ps_extensions
Definition: Setup.php:834
NS_TALK
const NS_TALK
Definition: Defines.php:66
$wgLogNames
$wgLogNames
Lists the message key string for each log type.
Definition: DefaultSettings.php:7629
$wgFileCacheDirectory
$wgFileCacheDirectory
Directory where the cached page will be saved.
Definition: DefaultSettings.php:272
$wgUploadPath
$wgUploadPath
The URL path for the images directory.
Definition: DefaultSettings.php:261
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:183
wfWarn
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Definition: GlobalFunctions.php:1190
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:73
$wgDBuser
$wgDBuser
Database username.
Definition: DefaultSettings.php:1787
$wgAuth
$wgAuth $wgAuth
Authentication plugin.
Definition: DefaultSettings.php:7337
$wgDBerrorLogTZ
$wgDBerrorLogTZ
Timezone to use in the error log.
Definition: DefaultSettings.php:2016
$wgPasswordPolicy
$wgPasswordPolicy
Password policy for local wiki users.
Definition: DefaultSettings.php:4516
$wgDebugDumpSql
$wgDebugDumpSql
Write SQL queries to the debug log.
Definition: DefaultSettings.php:6122
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:662
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
Pingback\schedulePingback
static schedulePingback()
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send...
Definition: Pingback.php:254
$wgMinimalPasswordLength
$wgMinimalPasswordLength
Specifies the minimal length of a user password.
Definition: DefaultSettings.php:4735
$wgRCFilterByAge
$wgRCFilterByAge
Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be store...
Definition: DefaultSettings.php:6705
$wgServerName
if( $wgServerName !==false) $wgServerName
Definition: Setup.php:585
$wgDebugToolbar
$wgDebugToolbar
Display the new debugging toolbar.
Definition: DefaultSettings.php:6397
NS_FILE_TALK
const NS_FILE_TALK
Definition: Defines.php:72
$wgOut
$wgOut
Definition: Setup.php:819
NS_CATEGORY_TALK
const NS_CATEGORY_TALK
Definition: Defines.php:80
$wgPasswordSender
$wgPasswordSender
Sender email address for e-mail notifications.
Definition: DefaultSettings.php:1577
$wgContLang
$wgContLang
Definition: Setup.php:717
$wgPHPSessionHandling
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
Definition: DefaultSettings.php:2438
$wgExtraLanguageCodes
$wgExtraLanguageCodes
List of mappings from one language code to another.
Definition: DefaultSettings.php:2923
$wgScriptPath
$wgScriptPath
The path we should point to.
Definition: DefaultSettings.php:141
DBO_DEFAULT
const DBO_DEFAULT
Definition: defines.php:13
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:203
$wgForeignFileRepos
$wgForeignFileRepos
Definition: DefaultSettings.php:522
$wgLocalStylePath
$wgLocalStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:225
$wgSecureLogin
$wgSecureLogin
This is to let user authenticate using https when they come from http.
Definition: DefaultSettings.php:4955
$wgMainStash
$wgMainStash
Main object stash type.
Definition: DefaultSettings.php:2399
$wgExtraNamespaces
$wgExtraNamespaces
Additional namespaces.
Definition: DefaultSettings.php:3893
$wgInitialSessionId
$wgInitialSessionId
Definition: Setup.php:745
$wgNewUserLog
$wgNewUserLog
Maintain a log of newusers at Log/newusers?
Definition: DefaultSettings.php:7794
$wgMainWANCache
$wgMainWANCache
Main Wide-Area-Network cache type.
Definition: DefaultSettings.php:2340
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:586
$wgRightsUrl
$wgRightsUrl
Set this to specify an external URL containing details about the content license used on your wiki.
Definition: DefaultSettings.php:7027
$wgUsePathInfo
$wgUsePathInfo
Whether to support URLs like index.php/Page_title These often break when PHP is set up in CGI mode.
Definition: DefaultSettings.php:160
$wgSharedThumbnailScriptPath
$wgSharedThumbnailScriptPath
Definition: DefaultSettings.php:825