MediaWiki  1.29.2
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 various default paths sensibly...
53 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
54 
55 if ( $wgScript === false ) {
56  $wgScript = "$wgScriptPath/index.php";
57 }
58 if ( $wgLoadScript === false ) {
59  $wgLoadScript = "$wgScriptPath/load.php";
60 }
61 
62 if ( $wgArticlePath === false ) {
63  if ( $wgUsePathInfo ) {
64  $wgArticlePath = "$wgScript/$1";
65  } else {
66  $wgArticlePath = "$wgScript?title=$1";
67  }
68 }
69 
70 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
71  // 'view' is assumed the default action path everywhere in the code
72  // but is rarely filled in $wgActionPaths
74 }
75 
76 if ( $wgResourceBasePath === null ) {
77  $wgResourceBasePath = $wgScriptPath;
78 }
79 if ( $wgStylePath === false ) {
80  $wgStylePath = "$wgResourceBasePath/skins";
81 }
82 if ( $wgLocalStylePath === false ) {
83  // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN)
84  $wgLocalStylePath = "$wgScriptPath/skins";
85 }
86 if ( $wgExtensionAssetsPath === false ) {
87  $wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
88 }
89 
90 if ( $wgLogo === false ) {
91  $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
92 }
93 
94 if ( $wgUploadPath === false ) {
95  $wgUploadPath = "$wgScriptPath/images";
96 }
97 if ( $wgUploadDirectory === false ) {
98  $wgUploadDirectory = "$IP/images";
99 }
100 if ( $wgReadOnlyFile === false ) {
101  $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
102 }
103 if ( $wgFileCacheDirectory === false ) {
104  $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
105 }
106 if ( $wgDeletedDirectory === false ) {
107  $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
108 }
109 
110 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
111  $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
112 }
113 
114 if ( $wgEnableParserCache === false ) {
116 }
117 
118 // Fix path to icon images after they were moved in 1.24
119 if ( $wgRightsIcon ) {
120  $wgRightsIcon = str_replace(
121  "{$wgStylePath}/common/images/",
122  "{$wgResourceBasePath}/resources/assets/licenses/",
123  $wgRightsIcon
124  );
125 }
126 
127 if ( isset( $wgFooterIcons['copyright']['copyright'] )
128  && $wgFooterIcons['copyright']['copyright'] === []
129 ) {
130  if ( $wgRightsIcon || $wgRightsText ) {
131  $wgFooterIcons['copyright']['copyright'] = [
132  'url' => $wgRightsUrl,
133  'src' => $wgRightsIcon,
134  'alt' => $wgRightsText,
135  ];
136  }
137 }
138 
139 if ( isset( $wgFooterIcons['poweredby'] )
140  && isset( $wgFooterIcons['poweredby']['mediawiki'] )
141  && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
142 ) {
143  $wgFooterIcons['poweredby']['mediawiki']['src'] =
144  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
145  $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
146  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
147  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
148 }
149 
158 
166 
171  'name' => 'fsLockManager',
172  'class' => 'FSLockManager',
173  'lockDirectory' => "{$wgUploadDirectory}/lockdir",
174 ];
175 $wgLockManagers[] = [
176  'name' => 'nullLockManager',
177  'class' => 'NullLockManager',
178 ];
179 
183 if ( !$wgLocalFileRepo ) {
184  $wgLocalFileRepo = [
185  'class' => 'LocalRepo',
186  'name' => 'local',
187  'directory' => $wgUploadDirectory,
188  'scriptDirUrl' => $wgScriptPath,
189  'scriptExtension' => '.php',
191  'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
192  'thumbScriptUrl' => $wgThumbnailScriptPath,
193  'transformVia404' => !$wgGenerateThumbnailOnParse,
194  'deletedDir' => $wgDeletedDirectory,
195  'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
196  ];
197 }
201 if ( $wgUseSharedUploads ) {
202  if ( $wgSharedUploadDBname ) {
203  $wgForeignFileRepos[] = [
204  'class' => 'ForeignDBRepo',
205  'name' => 'shared',
206  'directory' => $wgSharedUploadDirectory,
207  'url' => $wgSharedUploadPath,
208  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
209  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
210  'transformVia404' => !$wgGenerateThumbnailOnParse,
211  'dbType' => $wgDBtype,
212  'dbServer' => $wgDBserver,
213  'dbUser' => $wgDBuser,
214  'dbPassword' => $wgDBpassword,
215  'dbName' => $wgSharedUploadDBname,
216  'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
217  'tablePrefix' => $wgSharedUploadDBprefix,
218  'hasSharedCache' => $wgCacheSharedUploads,
219  'descBaseUrl' => $wgRepositoryBaseUrl,
220  'fetchDescription' => $wgFetchCommonsDescriptions,
221  ];
222  } else {
223  $wgForeignFileRepos[] = [
224  'class' => 'FileRepo',
225  'name' => 'shared',
226  'directory' => $wgSharedUploadDirectory,
227  'url' => $wgSharedUploadPath,
228  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
229  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
230  'transformVia404' => !$wgGenerateThumbnailOnParse,
231  'descBaseUrl' => $wgRepositoryBaseUrl,
232  'fetchDescription' => $wgFetchCommonsDescriptions,
233  ];
234  }
235 }
236 if ( $wgUseInstantCommons ) {
237  $wgForeignFileRepos[] = [
238  'class' => 'ForeignAPIRepo',
239  'name' => 'wikimediacommons',
240  'apibase' => 'https://commons.wikimedia.org/w/api.php',
241  'url' => 'https://upload.wikimedia.org/wikipedia/commons',
242  'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
243  'hashLevels' => 2,
244  'transformVia404' => true,
245  'fetchDescription' => true,
246  'descriptionCacheExpiry' => 43200,
247  'apiThumbCacheExpiry' => 0,
248  ];
249 }
250 /*
251  * Add on default file backend config for file repos.
252  * FileBackendGroup will handle initializing the backends.
253  */
254 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
255  $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
256 }
257 foreach ( $wgForeignFileRepos as &$repo ) {
258  if ( !isset( $repo['directory'] ) && $repo['class'] === 'ForeignAPIRepo' ) {
259  $repo['directory'] = $wgUploadDirectory; // b/c
260  }
261  if ( !isset( $repo['backend'] ) ) {
262  $repo['backend'] = $repo['name'] . '-backend';
263  }
264 }
265 unset( $repo ); // no global pollution; destroy reference
266 
267 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
268 if ( $wgRCFilterByAge ) {
269  // Trim down $wgRCLinkDays so that it only lists links which are valid
270  // as determined by $wgRCMaxAge.
271  // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
272  sort( $wgRCLinkDays );
273 
274  // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
275  for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
276  // @codingStandardsIgnoreEnd
277  if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
278  $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
279  break;
280  }
281  }
282 }
283 // Ensure that default user options are not invalid, since that breaks Special:Preferences
284 $wgDefaultUserOptions['rcdays'] = min(
285  $wgDefaultUserOptions['rcdays'],
286  ceil( $rcMaxAgeDays )
287 );
288 $wgDefaultUserOptions['watchlistdays'] = min(
289  $wgDefaultUserOptions['watchlistdays'],
290  ceil( $rcMaxAgeDays )
291 );
292 unset( $rcMaxAgeDays );
293 
294 if ( $wgSkipSkin ) {
295  $wgSkipSkins[] = $wgSkipSkin;
296 }
297 
298 $wgSkipSkins[] = 'fallback';
299 $wgSkipSkins[] = 'apioutput';
300 
301 if ( $wgLocalInterwiki ) {
302  array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
303 }
304 
305 // Set default shared prefix
306 if ( $wgSharedPrefix === false ) {
308 }
309 
310 // Set default shared schema
311 if ( $wgSharedSchema === false ) {
313 }
314 
315 if ( !$wgCookiePrefix ) {
316  if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
318  } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
320  } elseif ( $wgDBprefix ) {
322  } else {
324  }
325 }
326 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
327 
328 if ( $wgEnableEmail ) {
330 } else {
331  // Disable all other email settings automatically if $wgEnableEmail
332  // is set to false. - T65678
333  $wgAllowHTMLEmail = false;
334  $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
344  unset( $wgGroupPermissions['user']['sendemail'] );
345  $wgUseEnotif = false;
348 }
349 
350 if ( $wgMetaNamespace === false ) {
351  $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
352 }
353 
354 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
355 if ( $wgResourceLoaderMaxQueryLength === false ) {
356  $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
357  if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
358  $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
359  } else {
360  $wgResourceLoaderMaxQueryLength = 2000;
361  }
362  unset( $suhosinMaxValueLength );
363 }
364 
365 // Ensure the minimum chunk size is less than PHP upload limits or the maximum
366 // upload size.
369  UploadBase::getMaxUploadSize( 'file' ),
370  UploadBase::getMaxPhpUploadSize(),
372  ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
373  PHP_INT_MAX
374  ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
375 );
376 
382  NS_MEDIA => 'Media',
383  NS_SPECIAL => 'Special',
384  NS_TALK => 'Talk',
385  NS_USER => 'User',
386  NS_USER_TALK => 'User_talk',
387  NS_PROJECT => 'Project',
388  NS_PROJECT_TALK => 'Project_talk',
389  NS_FILE => 'File',
390  NS_FILE_TALK => 'File_talk',
391  NS_MEDIAWIKI => 'MediaWiki',
392  NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
393  NS_TEMPLATE => 'Template',
394  NS_TEMPLATE_TALK => 'Template_talk',
395  NS_HELP => 'Help',
396  NS_HELP_TALK => 'Help_talk',
397  NS_CATEGORY => 'Category',
398  NS_CATEGORY_TALK => 'Category_talk',
399 ];
400 
402 if ( is_array( $wgExtraNamespaces ) ) {
404 }
405 
406 // Merge in the legacy language codes, incorporating overrides from the config
408  'qqq' => 'qqq', // Used for message documentation
409  'qqx' => 'qqx', // Used for viewing message keys
411 
412 // These are now the same, always
413 // To determine the user language, use $wgLang->getCode()
415 
416 // Easy to forget to falsify $wgDebugToolbar for static caches.
417 // If file cache or CDN cache is on, just disable this (DWIMD).
418 if ( $wgUseFileCache || $wgUseSquid ) {
419  $wgDebugToolbar = false;
420 }
421 
422 // We always output HTML5 since 1.22, overriding these is no longer supported
423 // we set them here for extensions that depend on its value.
424 $wgHtml5 = true;
425 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
426 $wgJsMimeType = 'text/javascript';
427 
428 // Blacklisted file extensions shouldn't appear on the "allowed" list
429 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
430 
432  MediaWiki\suppressWarnings();
433  $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
434  MediaWiki\restoreWarnings();
435 }
436 
437 if ( $wgNewUserLog ) {
438  // Add a new log type
439  $wgLogTypes[] = 'newusers';
440  $wgLogNames['newusers'] = 'newuserlogpage';
441  $wgLogHeaders['newusers'] = 'newuserlogpagetext';
442  $wgLogActionsHandlers['newusers/newusers'] = 'NewUsersLogFormatter';
443  $wgLogActionsHandlers['newusers/create'] = 'NewUsersLogFormatter';
444  $wgLogActionsHandlers['newusers/create2'] = 'NewUsersLogFormatter';
445  $wgLogActionsHandlers['newusers/byemail'] = 'NewUsersLogFormatter';
446  $wgLogActionsHandlers['newusers/autocreate'] = 'NewUsersLogFormatter';
447 }
448 
449 if ( $wgPageLanguageUseDB ) {
450  $wgLogTypes[] = 'pagelang';
451  $wgLogActionsHandlers['pagelang/pagelang'] = 'PageLangLogFormatter';
452 }
453 
454 if ( $wgCookieSecure === 'detect' ) {
455  $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
456 }
457 
458 if ( $wgProfileOnly ) {
459  $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
460  $wgDebugLogFile = '';
461 }
462 
463 // Backwards compatibility with old password limits
464 if ( $wgMinimalPasswordLength !== false ) {
465  $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
466 }
467 
468 if ( $wgMaximalPasswordLength !== false ) {
469  $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
470 }
471 
472 // Backwards compatibility warning
473 if ( !$wgSessionsInObjectCache ) {
474  wfDeprecated( '$wgSessionsInObjectCache = false', '1.27' );
475  if ( $wgSessionHandler ) {
476  wfDeprecated( '$wgSessionsHandler', '1.27' );
477  }
478  $cacheType = get_class( ObjectCache::getInstance( $wgSessionCacheType ) );
479  wfDebugLog(
480  'caches',
481  "Session data will be stored in \"$cacheType\" cache with " .
482  "expiry $wgObjectCacheSessionExpiry seconds"
483  );
484 }
486 
487 if ( $wgPHPSessionHandling !== 'enable' &&
488  $wgPHPSessionHandling !== 'warn' &&
489  $wgPHPSessionHandling !== 'disable'
490 ) {
491  $wgPHPSessionHandling = 'warn';
492 }
493 if ( defined( 'MW_NO_SESSION' ) ) {
494  // If the entry point wants no session, force 'disable' here unless they
495  // specifically set it to the (undocumented) 'warn'.
496  $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
497 }
498 
499 Profiler::instance()->scopedProfileOut( $ps_default );
500 
501 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
502 // all the memory from logging SQL queries on maintenance scripts
504 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
505  MWDebug::init();
506 }
507 
508 // Reset the global service locator, so any services that have already been created will be
509 // re-created while taking into account any custom settings and extensions.
510 MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
511 
512 if ( $wgSharedDB && $wgSharedTables ) {
513  // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
514  MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
515  array_fill_keys(
517  [
518  'dbname' => $wgSharedDB,
519  'schema' => $wgSharedSchema,
520  'prefix' => $wgSharedPrefix
521  ]
522  )
523  );
524 }
525 
526 // Define a constant that indicates that the bootstrapping of the service locator
527 // is complete.
528 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
529 
531 
532 require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
533 
534 $ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
535 
536 // T48998: Bail out early if $wgArticlePath is non-absolute
537 foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) {
538  if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
539  throw new FatalError(
540  "If you use a relative URL for \$$varName, it must start " .
541  'with a slash (<code>/</code>).<br><br>See ' .
542  "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
543  "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
544  );
545  }
546 }
547 
548 Profiler::instance()->scopedProfileOut( $ps_validation );
549 
550 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
551 
552 if ( $wgCanonicalServer === false ) {
554 }
555 
556 // Set server name
558 if ( $wgServerName !== false ) {
559  wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
560  . 'not customized. Overwriting $wgServerName.' );
561 }
563 unset( $serverParts );
564 
565 // Set defaults for configuration variables
566 // that are derived from the server name by default
567 // Note: $wgEmergencyContact and $wgPasswordSender may be false or empty string (T104142)
568 if ( !$wgEmergencyContact ) {
569  $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
570 }
571 if ( !$wgPasswordSender ) {
572  $wgPasswordSender = 'apache@' . $wgServerName;
573 }
574 if ( !$wgNoReplyAddress ) {
576 }
577 
578 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
579  $wgSecureLogin = false;
580  wfWarn( 'Secure login was enabled on a server that only supports '
581  . 'HTTP or HTTPS. Disabling secure login.' );
582 }
583 
585 
586 // Now that GlobalFunctions is loaded, set defaults that depend on it.
587 if ( $wgTmpDirectory === false ) {
589 }
590 
591 // We don't use counters anymore. Left here for extensions still
592 // expecting this to exist. Should be removed sometime 1.26 or later.
593 if ( !isset( $wgDisableCounters ) ) {
594  $wgDisableCounters = true;
595 }
596 
597 if ( $wgMainWANCache === false ) {
598  // Setup a WAN cache from $wgMainCacheType with no relayer.
599  // Sites using multiple datacenters can configure a relayer.
600  $wgMainWANCache = 'mediawiki-main-default';
602  'class' => 'WANObjectCache',
603  'cacheId' => $wgMainCacheType,
604  'channels' => [ 'purge' => 'wancache-main-default-purge' ]
605  ];
606 }
607 
608 Profiler::instance()->scopedProfileOut( $ps_default2 );
609 
610 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );
611 
612 // Raise the memory limit if it's too low
613 wfMemoryLimit();
614 
620 if ( is_null( $wgLocaltimezone ) ) {
621  MediaWiki\suppressWarnings();
622  $wgLocaltimezone = date_default_timezone_get();
623  MediaWiki\restoreWarnings();
624 }
625 
626 date_default_timezone_set( $wgLocaltimezone );
627 if ( is_null( $wgLocalTZoffset ) ) {
628  $wgLocalTZoffset = date( 'Z' ) / 60;
629 }
630 // The part after the System| is ignored, but rest of MW fills it
631 // out as the local offset.
632 $wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
633 
634 if ( !$wgDBerrorLogTZ ) {
635  $wgDBerrorLogTZ = $wgLocaltimezone;
636 }
637 
638 // initialize the request object in $wgRequest
639 $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
640 // Set user IP/agent information for causal consistency purposes
641 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
642  'IPAddress' => $wgRequest->getIP(),
643  'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
644  'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' )
645 ] );
646 
647 // Useful debug output
648 if ( $wgCommandLineMode ) {
649  wfDebug( "\n\nStart command line script $self\n" );
650 } else {
651  $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
652 
653  if ( $wgDebugPrintHttpHeaders ) {
654  $debug .= "HTTP HEADERS:\n";
655 
656  foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
657  $debug .= "$name: $value\n";
658  }
659  }
660  wfDebug( $debug );
661 }
662 
663 Profiler::instance()->scopedProfileOut( $ps_misc );
664 $ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' );
665 
669 
670 wfDebugLog( 'caches',
671  'cluster: ' . get_class( $wgMemc ) .
672  ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
673  ', stash: ' . $wgMainStash .
674  ', message: ' . get_class( $messageMemc ) .
675  ', parser: ' . get_class( $parserMemc ) .
676  ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
677 );
678 
679 Profiler::instance()->scopedProfileOut( $ps_memcached );
680 
681 // Most of the config is out, some might want to run hooks here.
682 Hooks::run( 'SetupAfterCache' );
683 
684 $ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
685 
690 $wgContLang->initContLang();
691 
692 // Now that variant lists may be available...
693 $wgRequest->interpolateTitle();
694 
695 if ( !is_object( $wgAuth ) ) {
697  Hooks::run( 'AuthPluginSetup', [ &$wgAuth ] );
698 }
699 if ( $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin ) {
700  MediaWiki\Auth\AuthManager::singleton()->forcePrimaryAuthenticationProviders( [
701  new MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider( [
702  'authoritative' => false,
703  ] ),
704  new MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider( $wgAuth ),
705  new MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider( [
706  'authoritative' => true,
707  ] ),
708  ], '$wgAuth is ' . get_class( $wgAuth ) );
709 }
710 
711 // Set up the session
712 $ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
718 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
719  // If session.auto_start is there, we can't touch session name
720  if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
721  session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
722  }
723 
724  // Create the SessionManager singleton and set up our session handler,
725  // unless we're specifically asked not to.
726  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
728  MediaWiki\Session\SessionManager::singleton()
729  );
730  }
731 
732  // Initialize the session
733  try {
735  } catch ( OverflowException $ex ) {
736  if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
737  // The exception is because the request had multiple possible
738  // sessions tied for top priority. Report this to the user.
739  $list = [];
740  foreach ( $ex->sessionInfos as $info ) {
741  $list[] = $info->getProvider()->describe( $wgContLang );
742  }
743  $list = $wgContLang->listToText( $list );
744  throw new HttpError( 400,
745  Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )->plain()
746  );
747  }
748 
749  // Not the one we want, rethrow
750  throw $ex;
751  }
752 
753  if ( $session->isPersistent() ) {
754  $wgInitialSessionId = $session->getSessionId();
755  }
756 
757  $session->renew();
758  if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
759  ( $session->isPersistent() || $session->shouldRememberUser() )
760  ) {
761  // Start the PHP-session for backwards compatibility
762  session_id( $session->getId() );
763  MediaWiki\quietCall( 'session_start' );
764  }
765 
766  unset( $session );
767 } else {
768  // Even if we didn't set up a global Session, still install our session
769  // handler unless specifically requested not to.
770  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
772  MediaWiki\Session\SessionManager::singleton()
773  );
774  }
775 }
776 Profiler::instance()->scopedProfileOut( $ps_session );
777 
781 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
782 
787 
791 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
792 
796 $wgParser = new StubObject( 'wgParser', function () {
797  return MediaWikiServices::getInstance()->getParser();
798 } );
799 
803 $wgTitle = null;
804 
805 Profiler::instance()->scopedProfileOut( $ps_globals );
806 $ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
807 
808 // Extension setup functions
809 // Entries should be added to this variable during the inclusion
810 // of the extension file. This allows the extension to perform
811 // any necessary initialisation in the fully initialised environment
812 foreach ( $wgExtensionFunctions as $func ) {
813  // Allow closures in PHP 5.3+
814  if ( is_object( $func ) && $func instanceof Closure ) {
815  $profName = $fname . '-extensions-closure';
816  } elseif ( is_array( $func ) ) {
817  if ( is_object( $func[0] ) ) {
818  $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
819  } else {
820  $profName = $fname . '-extensions-' . implode( '::', $func );
821  }
822  } else {
823  $profName = $fname . '-extensions-' . strval( $func );
824  }
825 
826  $ps_ext_func = Profiler::instance()->scopedProfileIn( $profName );
827  call_user_func( $func );
828  Profiler::instance()->scopedProfileOut( $ps_ext_func );
829 }
830 
831 // If the session user has a 0 id but a valid name, that means we need to
832 // autocreate it.
833 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
834  $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
835  if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
836  $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
837  $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
838  $sessionUser,
839  MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
840  true
841  );
842  Profiler::instance()->scopedProfileOut( $ps_autocreate );
843  \MediaWiki\Logger\LoggerFactory::getInstance( 'authevents' )->info( 'Autocreation attempt', [
844  'event' => 'autocreate',
845  'status' => $res,
846  ] );
847  unset( $res );
848  }
849  unset( $sessionUser );
850 }
851 
852 if ( !$wgCommandLineMode ) {
854 }
855 
857 
858 Profiler::instance()->scopedProfileOut( $ps_extensions );
859 Profiler::instance()->scopedProfileOut( $ps_setup );
$wgCanonicalNamespaceNames
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
Definition: Setup.php:381
LanguageCode\getDeprecatedCodeMapping
static getDeprecatedCodeMapping()
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up...
Definition: LanguageCode.php:40
$ps_session
if(!is_object( $wgAuth)) if( $wgAuth &&! $wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin) $ps_session
Definition: Setup.php:712
$wgUser
$wgUser
Definition: Setup.php:781
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:347
MW_NO_SESSION
const MW_NO_SESSION
Definition: load.php:30
$wgDBserver
$wgDBserver
Database host name or IP address.
Definition: DefaultSettings.php:1750
$wgFileBlacklist
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
Definition: DefaultSettings.php:872
$wgActionPaths
$wgActionPaths
Definition: img_auth.php:46
NS_HELP
const NS_HELP
Definition: Defines.php:74
$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:157
$wgCookiePrefix
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:326
$wgMinUploadChunkSize
if( $wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Definition: Setup.php:367
$wgParser
$wgParser
Definition: Setup.php:796
$wgEnotifFromEditor
$wgEnotifFromEditor
Definition: Setup.php:336
$wgInvalidateCacheOnLocalSettingsChange
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
Definition: DefaultSettings.php:2595
$wgTmpDirectory
$wgTmpDirectory
The local filesystem path to a temporary directory.
Definition: DefaultSettings.php:334
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:62
$wgEnotifWatchlist
$wgEnotifWatchlist
Definition: Setup.php:343
$wgSharedTables
$wgSharedTables
Definition: DefaultSettings.php:1887
$wgSharedSchema
$wgSharedSchema
Definition: DefaultSettings.php:1893
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:429
NS_TEMPLATE_TALK
const NS_TEMPLATE_TALK
Definition: Defines.php:73
captcha-old.count
count
Definition: captcha-old.py:225
$wgDefaultUserOptions
if( $wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
Definition: Setup.php:284
$wgUserEmailUseReplyTo
$wgUserEmailUseReplyTo
Definition: Setup.php:346
$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:93
CACHE_NONE
const CACHE_NONE
Definition: Defines.php:100
$ps_misc
$ps_misc
Definition: Setup.php:610
$wgDBtype
$wgDBtype
Database type.
Definition: DefaultSettings.php:1775
MediaWiki\Auth\AuthManagerAuthPlugin
Backwards-compatibility wrapper for AuthManager via $wgAuth.
Definition: AuthManagerAuthPlugin.php:30
$wgSharedDB
$wgSharedDB
Shared database for multiple wikis.
Definition: DefaultSettings.php:1877
$wgLocalFileRepo
$wgLocalFileRepo
File repository structures.
Definition: DefaultSettings.php:517
$ps_memcached
$ps_memcached
Definition: Setup.php:664
$wgWANObjectCaches
$wgWANObjectCaches
Advanced WAN object cache configuration.
Definition: DefaultSettings.php:2335
$wgLang
$wgLang
Definition: Setup.php:786
$wgVersion
$wgVersion
MediaWiki version number.
Definition: DefaultSettings.php:78
$wgHtml5
if( $wgUseFileCache|| $wgUseSquid) $wgHtml5
Definition: Setup.php:424
$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:414
$wgDBmwschema
$wgDBmwschema
Mediawiki schema.
Definition: DefaultSettings.php:1845
$wgVirtualRestConfig
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//') $wgVirtualRestConfig['global']['domain']
Definition: Setup.php:584
$wgGenerateThumbnailOnParse
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
Definition: DefaultSettings.php:1210
$wgEnableUserEmail
$wgEnableUserEmail
Definition: Setup.php:335
$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:68
$wgExtensionAssetsPath
$wgExtensionAssetsPath
The URL path of the extensions directory.
Definition: DefaultSettings.php:232
NS_TEMPLATE
const NS_TEMPLATE
Definition: Defines.php:72
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:2633
$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:845
$res
$res
Definition: database.txt:21
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:304
$wgCacheDirectory
$wgCacheDirectory
Directory for caching data in the local filesystem.
Definition: DefaultSettings.php:2205
User\isValidUserName
static isValidUserName( $name)
Is the input a valid username?
Definition: User.php:835
$wgLogo
$wgLogo
The URL path of the wiki logo.
Definition: DefaultSettings.php:278
$wgEnableParserCache
$wgEnableParserCache
Kept for extension compatibility; see $wgParserCacheType.
Definition: DefaultSettings.php:2546
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:1092
HttpError
Show an error that looks like an HTTP server error.
Definition: HttpError.php:30
$wgDBpassword
$wgDBpassword
Database user's password.
Definition: DefaultSettings.php:1770
$wgDBprefix
$wgDBprefix
Table name prefix.
Definition: DefaultSettings.php:1827
$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:666
$debug
$debug
Definition: mcc.php:31
$wgRepositoryBaseUrl
$wgRepositoryBaseUrl
Base URL for a repository wiki.
Definition: DefaultSettings.php:855
$rcMaxAgeDays
$rcMaxAgeDays
Definition: Setup.php:267
$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:838
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:51
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:818
$wgNoReplyAddress
$wgNoReplyAddress
Reply-To address for e-mail notifications.
Definition: DefaultSettings.php:1576
wfGetMainCache
wfGetMainCache()
Get the main cache object.
Definition: GlobalFunctions.php:3407
$wgEnotifMaxRecips
$wgEnotifMaxRecips
Definition: Setup.php:338
$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:66
$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:1553
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1128
$ps_default
$ps_default
Definition: Setup.php:53
$wgUseFileCache
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
Definition: DefaultSettings.php:2532
$wgCommandLineMode
global $wgCommandLineMode
Definition: Setup.php:503
$ps_validation
$ps_validation
Definition: Setup.php:534
$parserMemc
$parserMemc
Definition: Setup.php:668
NS_MEDIAWIKI_TALK
const NS_MEDIAWIKI_TALK
Definition: Defines.php:71
$wgEnotifUserTalk
$wgEnotifUserTalk
Definition: Setup.php:342
$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:1882
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
$wgParserCacheType
$wgParserCacheType
The cache type for storing article HTML.
Definition: DefaultSettings.php:2240
$wgEnotifUseRealName
$wgEnotifUseRealName
Definition: Setup.php:341
$wgEnableEmail
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
Definition: DefaultSettings.php:1583
GlobalVarConfig
Accesses configuration settings from $GLOBALS.
Definition: GlobalVarConfig.php:28
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:76
wfMemoryLimit
wfMemoryLimit()
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
Definition: GlobalFunctions.php:3290
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:999
$wgDummyLanguageCodes
if(is_array( $wgExtraNamespaces)) $wgDummyLanguageCodes
Definition: Setup.php:407
$wgCanonicalServer
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
Definition: DefaultSettings.php:118
$wgEnotifRevealEditorAddress
$wgEnotifRevealEditorAddress
Definition: Setup.php:340
$wgLockManagers
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
Definition: Setup.php:170
$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:856
$ps_default2
$ps_default2
Definition: Setup.php:550
$wgEnotifMinorEdits
$wgEnotifMinorEdits
Definition: Setup.php:339
MediaWiki\Session\SessionManager\getGlobalSession
static getGlobalSession()
Get the "global" session.
Definition: SessionManager.php:106
$wgTitle
$wgTitle
Definition: Setup.php:803
$wgSessionHandler
$wgSessionHandler
Definition: DefaultSettings.php:2398
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:65
$messageMemc
$messageMemc
Definition: Setup.php:667
$value
$value
Definition: styleTest.css.php:45
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:50
$wgNamespaceAliases
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
Definition: Setup.php:164
$wgDeletedDirectory
$wgDeletedDirectory
What directory to place deleted uploads in.
Definition: DefaultSettings.php:413
StubUserLang
Stub object for the user language.
Definition: StubObject.php:179
$wgServer
$wgServer
URL of the server.
Definition: DefaultSettings.php:109
$wgLanguageCode
$wgLanguageCode
Site language code.
Definition: DefaultSettings.php:2839
$wgSitename
$wgSitename
Name of the site.
Definition: DefaultSettings.php:83
PROTO_HTTP
const PROTO_HTTP
Definition: Defines.php:217
$wgJsMimeType
$wgJsMimeType
Definition: Setup.php:426
NS_PROJECT_TALK
const NS_PROJECT_TALK
Definition: Defines.php:67
MWDebug\init
static init()
Enabled the debugger and load resource module.
Definition: MWDebug.php:76
$wgSessionsInObjectCache
if( $wgInvalidateCacheOnLocalSettingsChange) if( $wgNewUserLog) if( $wgPageLanguageUseDB) if( $wgCookieSecure==='detect') if( $wgProfileOnly) if( $wgMinimalPasswordLength !==false) if( $wgMaximalPasswordLength !==false) if(! $wgSessionsInObjectCache) $wgSessionsInObjectCache
Definition: Setup.php:485
$wgEmailAuthentication
$wgEmailAuthentication
Definition: Setup.php:334
$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
wfGetParserCacheStorage
wfGetParserCacheStorage()
Get the cache object used by the parser cache.
Definition: GlobalFunctions.php:3427
$wgAllowHTMLEmail
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
Definition: DefaultSettings.php:1658
RequestContext\getMain
static getMain()
Static methods.
Definition: RequestContext.php:468
wfIniGetBool
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
Definition: GlobalFunctions.php:2176
plain
either a plain
Definition: hooks.txt:2007
$serverParts
if( $wgCanonicalServer===false) $serverParts
Definition: Setup.php:557
$wgUseEnotif
$wgUseEnotif
Definition: Setup.php:345
$wgSessionCacheType
$wgSessionCacheType
The cache type for storing session data.
Definition: DefaultSettings.php:2247
$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:3417
$wgCacheEpoch
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
Definition: DefaultSettings.php:2510
wfShorthandToInteger
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:3339
$wgGitInfoCacheDirectory
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
Definition: DefaultSettings.php:2516
$wgXhtmlDefaultNamespace
$wgXhtmlDefaultNamespace
Definition: Setup.php:425
$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:2061
$wgSharedUploadDirectory
$wgSharedUploadDirectory
Path on the file system where shared uploads can be found.
Definition: DefaultSettings.php:706
$wgSkipSkins
if( $wgSkipSkin) $wgSkipSkins[]
Definition: Setup.php:298
NS_HELP_TALK
const NS_HELP_TALK
Definition: Defines.php:75
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:818
FatalError
Exception class which takes an HTML error message, and does not produce a backtrace.
Definition: FatalError.php:28
$wgEnotifImpersonal
$wgEnotifImpersonal
Definition: Setup.php:337
$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
$ps_globals
$ps_globals
Definition: Setup.php:684
NS_USER
const NS_USER
Definition: Defines.php:64
$ps_extensions
$ps_extensions
Definition: Setup.php:806
NS_TALK
const NS_TALK
Definition: Defines.php:63
$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:1142
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:70
$wgDBuser
$wgDBuser
Database username.
Definition: DefaultSettings.php:1765
$wgDBerrorLogTZ
$wgDBerrorLogTZ
Timezone to use in the error log.
Definition: DefaultSettings.php:1994
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:639
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:253
$wgServerName
if( $wgServerName !==false) $wgServerName
Definition: Setup.php:562
NS_FILE_TALK
const NS_FILE_TALK
Definition: Defines.php:69
$wgOut
$wgOut
Definition: Setup.php:791
NS_CATEGORY_TALK
const NS_CATEGORY_TALK
Definition: Defines.php:77
$wgPasswordSender
$wgPasswordSender
Sender email address for e-mail notifications.
Definition: DefaultSettings.php:1562
$wgContLang
$wgContLang
Definition: Setup.php:689
$wgPHPSessionHandling
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
Definition: DefaultSettings.php:2416
$wgExtraLanguageCodes
$wgExtraLanguageCodes
List of mappings from one language code to another.
Definition: DefaultSettings.php:2901
$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:131
$wgForeignFileRepos
$wgForeignFileRepos
Definition: DefaultSettings.php:522
$wgLocalStylePath
$wgLocalStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:225
$wgMainStash
$wgMainStash
Main object stash type.
Definition: DefaultSettings.php:2377
$wgInitialSessionId
$wgInitialSessionId
Definition: Setup.php:717
$wgMainWANCache
$wgMainWANCache
Main Wide-Area-Network cache type.
Definition: DefaultSettings.php:2318
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:552
$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:823