MediaWiki  master
Setup.php
Go to the documentation of this file.
1 <?php
29 
34 if ( !defined( 'MEDIAWIKI' ) ) {
35  exit( 1 );
36 }
37 
38 // Check to see if we are at the file scope
39 $wgScopeTest = 'MediaWiki Setup.php scope test';
40 if ( !isset( $GLOBALS['wgScopeTest'] ) || $GLOBALS['wgScopeTest'] !== $wgScopeTest ) {
41  echo "Error, Setup.php must be included from the file scope.\n";
42  die( 1 );
43 }
44 unset( $wgScopeTest );
45 
50 // Sanity check (T5782, T122807)
51 if ( ini_get( 'mbstring.func_overload' ) ) {
52  die( 'MediaWiki does not support installations where mbstring.func_overload is non-zero.' );
53 }
54 
55 // Start the autoloader, so that extensions can derive classes from core files
56 require_once "$IP/includes/AutoLoader.php";
57 
58 // Load up some global defines
59 require_once "$IP/includes/Defines.php";
60 
61 // Load default settings
62 require_once "$IP/includes/DefaultSettings.php";
63 
64 // Load global functions
65 require_once "$IP/includes/GlobalFunctions.php";
66 
67 // Load composer's autoloader if present
68 if ( is_readable( "$IP/vendor/autoload.php" ) ) {
69  require_once "$IP/vendor/autoload.php";
70 } elseif ( file_exists( "$IP/vendor/autoload.php" ) ) {
71  die( "$IP/vendor/autoload.php exists but is not readable" );
72 }
73 
74 // Assert that composer dependencies were successfully loaded
75 // Purposely no leading \ due to it breaking HHVM RepoAuthorative mode
76 // PHP works fine with both versions
77 // See https://github.com/facebook/hhvm/issues/5833
78 if ( !interface_exists( 'Psr\Log\LoggerInterface' ) ) {
79  $message = (
80  'MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging ' .
81  "library</a> to be present. This library is not embedded directly in MediaWiki's " .
82  "git repository and must be installed separately by the end user.\n\n" .
83  'Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git' .
84  '#Fetch_external_libraries">mediawiki.org</a> for help on installing ' .
85  'the required components.'
86  );
87  echo $message;
88  trigger_error( $message, E_USER_ERROR );
89  die( 1 );
90 }
91 
92 // Install a header callback
94 
99 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
100  call_user_func( MW_CONFIG_CALLBACK );
101 } else {
102  if ( !defined( 'MW_CONFIG_FILE' ) ) {
103  define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
104  }
105  require_once MW_CONFIG_FILE;
106 }
107 
115 if ( defined( 'MW_SETUP_CALLBACK' ) ) {
116  call_user_func( MW_SETUP_CALLBACK );
117 }
118 
123 $fname = 'Setup.php';
124 $ps_setup = Profiler::instance()->scopedProfileIn( $fname );
125 
126 // Load queued extensions
127 ExtensionRegistry::getInstance()->loadFromQueue();
128 // Don't let any other extensions load
130 
131 mb_internal_encoding( 'UTF-8' );
132 
133 // Set the configured locale on all requests for consisteny
134 putenv( "LC_ALL=$wgShellLocale" );
135 setlocale( LC_ALL, $wgShellLocale );
136 
137 // Set various default paths sensibly...
138 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
139 
140 if ( $wgScript === false ) {
141  $wgScript = "$wgScriptPath/index.php";
142 }
143 if ( $wgLoadScript === false ) {
144  $wgLoadScript = "$wgScriptPath/load.php";
145 }
146 
147 if ( $wgArticlePath === false ) {
148  if ( $wgUsePathInfo ) {
149  $wgArticlePath = "$wgScript/$1";
150  } else {
151  $wgArticlePath = "$wgScript?title=$1";
152  }
153 }
154 
155 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
156  // 'view' is assumed the default action path everywhere in the code
157  // but is rarely filled in $wgActionPaths
158  $wgActionPaths['view'] = $wgArticlePath;
159 }
160 
161 if ( $wgResourceBasePath === null ) {
163 }
164 if ( $wgStylePath === false ) {
165  $wgStylePath = "$wgResourceBasePath/skins";
166 }
167 if ( $wgLocalStylePath === false ) {
168  // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN)
169  $wgLocalStylePath = "$wgScriptPath/skins";
170 }
171 if ( $wgExtensionAssetsPath === false ) {
172  $wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
173 }
174 
175 if ( $wgLogo === false ) {
176  $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
177 }
178 
179 if ( $wgUploadPath === false ) {
180  $wgUploadPath = "$wgScriptPath/images";
181 }
182 if ( $wgUploadDirectory === false ) {
183  $wgUploadDirectory = "$IP/images";
184 }
185 if ( $wgReadOnlyFile === false ) {
186  $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
187 }
188 if ( $wgFileCacheDirectory === false ) {
189  $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
190 }
191 if ( $wgDeletedDirectory === false ) {
192  $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
193 }
194 
195 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
196  $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
197 }
198 
199 // Fix path to icon images after they were moved in 1.24
200 if ( $wgRightsIcon ) {
201  $wgRightsIcon = str_replace(
202  "{$wgStylePath}/common/images/",
203  "{$wgResourceBasePath}/resources/assets/licenses/",
205  );
206 }
207 
208 if ( isset( $wgFooterIcons['copyright']['copyright'] )
209  && $wgFooterIcons['copyright']['copyright'] === []
210 ) {
211  if ( $wgRightsIcon || $wgRightsText ) {
212  $wgFooterIcons['copyright']['copyright'] = [
213  'url' => $wgRightsUrl,
214  'src' => $wgRightsIcon,
215  'alt' => $wgRightsText,
216  ];
217  }
218 }
219 
220 if ( isset( $wgFooterIcons['poweredby'] )
221  && isset( $wgFooterIcons['poweredby']['mediawiki'] )
222  && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
223 ) {
224  $wgFooterIcons['poweredby']['mediawiki']['src'] =
225  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
226  $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
227  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
228  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
229 }
230 
239 
247 
252  'name' => 'fsLockManager',
253  'class' => FSLockManager::class,
254  'lockDirectory' => "{$wgUploadDirectory}/lockdir",
255 ];
256 $wgLockManagers[] = [
257  'name' => 'nullLockManager',
258  'class' => NullLockManager::class,
259 ];
260 
266  'imagesPerRow' => 0,
267  'imageWidth' => 120,
268  'imageHeight' => 120,
269  'captionLength' => true,
270  'showBytes' => true,
271  'showDimensions' => true,
272  'mode' => 'traditional',
273 ];
274 
278 if ( !$wgLocalFileRepo ) {
279  $wgLocalFileRepo = [
280  'class' => LocalRepo::class,
281  'name' => 'local',
282  'directory' => $wgUploadDirectory,
283  'scriptDirUrl' => $wgScriptPath,
285  'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
286  'thumbScriptUrl' => $wgThumbnailScriptPath,
287  'transformVia404' => !$wgGenerateThumbnailOnParse,
288  'deletedDir' => $wgDeletedDirectory,
289  'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
290  ];
291 }
292 
293 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
294  // Create a default FileBackend name.
295  // FileBackendGroup will register a default, if absent from $wgFileBackends.
296  $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
297 }
298 
302 if ( $wgUseSharedUploads ) {
303  if ( $wgSharedUploadDBname ) {
304  $wgForeignFileRepos[] = [
305  'class' => ForeignDBRepo::class,
306  'name' => 'shared',
307  'directory' => $wgSharedUploadDirectory,
308  'url' => $wgSharedUploadPath,
309  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
310  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
311  'transformVia404' => !$wgGenerateThumbnailOnParse,
312  'dbType' => $wgDBtype,
313  'dbServer' => $wgDBserver,
314  'dbUser' => $wgDBuser,
315  'dbPassword' => $wgDBpassword,
316  'dbName' => $wgSharedUploadDBname,
317  'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
318  'tablePrefix' => $wgSharedUploadDBprefix,
319  'hasSharedCache' => $wgCacheSharedUploads,
320  'descBaseUrl' => $wgRepositoryBaseUrl,
321  'fetchDescription' => $wgFetchCommonsDescriptions,
322  ];
323  } else {
324  $wgForeignFileRepos[] = [
325  'class' => FileRepo::class,
326  'name' => 'shared',
327  'directory' => $wgSharedUploadDirectory,
328  'url' => $wgSharedUploadPath,
329  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
330  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
331  'transformVia404' => !$wgGenerateThumbnailOnParse,
332  'descBaseUrl' => $wgRepositoryBaseUrl,
333  'fetchDescription' => $wgFetchCommonsDescriptions,
334  ];
335  }
336 }
337 if ( $wgUseInstantCommons ) {
338  $wgForeignFileRepos[] = [
339  'class' => ForeignAPIRepo::class,
340  'name' => 'wikimediacommons',
341  'apibase' => 'https://commons.wikimedia.org/w/api.php',
342  'url' => 'https://upload.wikimedia.org/wikipedia/commons',
343  'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
344  'hashLevels' => 2,
345  'transformVia404' => true,
346  'fetchDescription' => true,
347  'descriptionCacheExpiry' => 43200,
348  'apiThumbCacheExpiry' => 0,
349  ];
350 }
351 foreach ( $wgForeignFileRepos as &$repo ) {
352  if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) {
353  $repo['directory'] = $wgUploadDirectory; // b/c
354  }
355  if ( !isset( $repo['backend'] ) ) {
356  $repo['backend'] = $repo['name'] . '-backend';
357  }
358 }
359 unset( $repo ); // no global pollution; destroy reference
360 
361 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
362 if ( $wgRCFilterByAge ) {
363  // Trim down $wgRCLinkDays so that it only lists links which are valid
364  // as determined by $wgRCMaxAge.
365  // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
366  sort( $wgRCLinkDays );
367 
368  foreach ( $wgRCLinkDays as $i => $days ) {
369  if ( $days >= $rcMaxAgeDays ) {
370  array_splice( $wgRCLinkDays, $i + 1 );
371  break;
372  }
373  }
374 }
375 // Ensure that default user options are not invalid, since that breaks Special:Preferences
376 $wgDefaultUserOptions['rcdays'] = min(
377  $wgDefaultUserOptions['rcdays'],
378  ceil( $rcMaxAgeDays )
379 );
380 $wgDefaultUserOptions['watchlistdays'] = min(
381  $wgDefaultUserOptions['watchlistdays'],
382  ceil( $rcMaxAgeDays )
383 );
384 unset( $rcMaxAgeDays );
385 
386 if ( $wgSkipSkin ) {
388 }
389 
390 $wgSkipSkins[] = 'fallback';
391 $wgSkipSkins[] = 'apioutput';
392 
393 if ( $wgLocalInterwiki ) {
394  array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
395 }
396 
397 // Set default shared prefix
398 if ( $wgSharedPrefix === false ) {
400 }
401 
402 // Set default shared schema
403 if ( $wgSharedSchema === false ) {
405 }
406 
407 if ( !$wgCookiePrefix ) {
408  if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
410  } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
412  } elseif ( $wgDBprefix ) {
414  } else {
416  }
417 }
418 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
419 
420 if ( $wgEnableEmail ) {
422 } else {
423  // Disable all other email settings automatically if $wgEnableEmail
424  // is set to false. - T65678
425  $wgAllowHTMLEmail = false;
426  $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
436  unset( $wgGroupPermissions['user']['sendemail'] );
437  $wgUseEnotif = false;
440 }
441 
442 if ( $wgMetaNamespace === false ) {
443  $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
444 }
445 
446 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
447 if ( $wgResourceLoaderMaxQueryLength === false ) {
448  $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
449  if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
450  $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
451  } else {
453  }
454  unset( $suhosinMaxValueLength );
455 }
456 
457 // Ensure the minimum chunk size is less than PHP upload limits or the maximum
458 // upload size.
464  ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
465  PHP_INT_MAX
466  ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
467 );
468 
474  NS_MEDIA => 'Media',
475  NS_SPECIAL => 'Special',
476  NS_TALK => 'Talk',
477  NS_USER => 'User',
478  NS_USER_TALK => 'User_talk',
479  NS_PROJECT => 'Project',
480  NS_PROJECT_TALK => 'Project_talk',
481  NS_FILE => 'File',
482  NS_FILE_TALK => 'File_talk',
483  NS_MEDIAWIKI => 'MediaWiki',
484  NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
485  NS_TEMPLATE => 'Template',
486  NS_TEMPLATE_TALK => 'Template_talk',
487  NS_HELP => 'Help',
488  NS_HELP_TALK => 'Help_talk',
489  NS_CATEGORY => 'Category',
490  NS_CATEGORY_TALK => 'Category_talk',
491 ];
492 
494 if ( is_array( $wgExtraNamespaces ) ) {
496 }
497 
498 // Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php
499 if ( count( $wgDummyLanguageCodes ) !== 0 ) {
500  wfDeprecated( '$wgDummyLanguageCodes', '1.29' );
501 }
502 // Merge in the legacy language codes, incorporating overrides from the config
504  // Internal language codes of the private-use area which get mapped to
505  // themselves.
506  'qqq' => 'qqq', // Used for message documentation
507  'qqx' => 'qqx', // Used for viewing message keys
509 // Merge in (inverted) BCP 47 mappings
511  $bcp47 = strtolower( $bcp47 ); // force case-insensitivity
512  if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) {
514  }
515 }
516 
517 // These are now the same, always
518 // To determine the user language, use $wgLang->getCode()
520 
521 // Temporary backwards-compatibility reading of old Squid-named CDN settings as of MediaWiki 1.34,
522 // to support sysadmins who fail to update their settings immediately:
523 
524 if ( isset( $wgUseSquid ) ) {
525  // If the sysadmin is still setting a value of $wgUseSquid to true but $wgUseCdn is the default of
526  // false, to be safe, assume they do want this still, so enable it.
527  if ( !$wgUseCdn && $wgUseSquid ) {
528  $wgUseCdn = $wgUseSquid;
529  wfDeprecated( '$wgUseSquid enabled but $wgUseCdn disabled; enabling CDN functions', '1.34' );
530  }
531 } else {
532  // Backwards-compatibility for extensions that read this value.
533  $wgUseSquid = $wgUseCdn;
534 }
535 
536 if ( isset( $wgSquidServers ) ) {
537  // If the sysadmin is still setting a value of $wgSquidServers but $wgCdnServers is the default of
538  // empty, to be safe, assume they do want these servers to be still used, so use them.
539  if ( !empty( $wgSquidServers ) && empty( $wgCdnServers ) ) {
540  $wgCdnServers = $wgSquidServers;
541  wfDeprecated( '$wgSquidServers set, $wgCdnServers empty; using them', '1.34' );
542  }
543 } else {
544  // Backwards-compatibility for extensions that read this value.
545  $wgSquidServers = $wgCdnServers;
546 }
547 
548 if ( isset( $wgSquidServersNoPurge ) ) {
549  // If the sysadmin is still setting values in $wgSquidServersNoPurge but $wgCdnServersNoPurge is
550  // the default of empty, to be safe, assume they do want these servers to be still used, so use
551  // them.
552  if ( !empty( $wgSquidServersNoPurge ) && empty( $wgCdnServersNoPurge ) ) {
553  $wgCdnServersNoPurge = $wgSquidServersNoPurge;
554  wfDeprecated( '$wgSquidServersNoPurge set, $wgCdnServersNoPurge empty; using them', '1.34' );
555  }
556 } else {
557  // Backwards-compatibility for extensions that read this value.
558  $wgSquidServersNoPurge = $wgCdnServersNoPurge;
559 }
560 
561 if ( isset( $wgSquidMaxage ) ) {
562  // If the sysadmin is still setting a value of $wgSquidMaxage and it's higher than $wgCdnMaxAge,
563  // to be safe, assume they want the higher (lower performance requirement) value, so use that.
564  if ( $wgCdnMaxAge < $wgSquidMaxage ) {
565  $wgCdnMaxAge = $wgSquidMaxage;
566  wfDeprecated( '$wgSquidMaxage set higher than $wgCdnMaxAge; using the higher value', '1.34' );
567  }
568 } else {
569  // Backwards-compatibility for extensions that read this value.
570  $wgSquidMaxage = $wgCdnMaxAge;
571 }
572 
573 // Easy to forget to falsify $wgDebugToolbar for static caches.
574 // If file cache or CDN cache is on, just disable this (DWIMD).
575 if ( $wgUseFileCache || $wgUseCdn ) {
576  $wgDebugToolbar = false;
577 }
578 
579 // We always output HTML5 since 1.22, overriding these is no longer supported
580 // we set them here for extensions that depend on its value.
581 $wgHtml5 = true;
582 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
583 $wgJsMimeType = 'text/javascript';
584 
585 // Blacklisted file extensions shouldn't appear on the "allowed" list
586 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
587 
589  Wikimedia\suppressWarnings();
590  $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
591  Wikimedia\restoreWarnings();
592 }
593 
594 if ( $wgNewUserLog ) {
595  // Add new user log type
596  $wgLogTypes[] = 'newusers';
597  $wgLogNames['newusers'] = 'newuserlogpage';
598  $wgLogHeaders['newusers'] = 'newuserlogpagetext';
599  $wgLogActionsHandlers['newusers/newusers'] = NewUsersLogFormatter::class;
603  $wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class;
604 }
605 
606 if ( $wgPageCreationLog ) {
607  // Add page creation log type
608  $wgLogTypes[] = 'create';
609  $wgLogActionsHandlers['create/create'] = LogFormatter::class;
610 }
611 
612 if ( $wgPageLanguageUseDB ) {
613  $wgLogTypes[] = 'pagelang';
614  $wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class;
615 }
616 
617 if ( $wgCookieSecure === 'detect' ) {
618  $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
619 }
620 
621 if ( $wgProfileOnly ) {
622  $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
623  $wgDebugLogFile = '';
624 }
625 
626 // Backwards compatibility with old password limits
627 if ( $wgMinimalPasswordLength !== false ) {
628  $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
629 }
630 
631 if ( $wgMaximalPasswordLength !== false ) {
632  $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
633 }
634 
635 if ( $wgPHPSessionHandling !== 'enable' &&
636  $wgPHPSessionHandling !== 'warn' &&
637  $wgPHPSessionHandling !== 'disable'
638 ) {
639  $wgPHPSessionHandling = 'warn';
640 }
641 if ( defined( 'MW_NO_SESSION' ) ) {
642  // If the entry point wants no session, force 'disable' here unless they
643  // specifically set it to the (undocumented) 'warn'.
644  $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
645 }
646 
647 Profiler::instance()->scopedProfileOut( $ps_default );
648 
649 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
650 // all the memory from logging SQL queries on maintenance scripts
652 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
653  MWDebug::init();
654 }
655 
656 // Reset the global service locator, so any services that have already been created will be
657 // re-created while taking into account any custom settings and extensions.
658 MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
659 
660 // Define a constant that indicates that the bootstrapping of the service locator
661 // is complete.
662 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
663 
665 
666 // T48998: Bail out early if $wgArticlePath is non-absolute
667 foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) {
668  if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
669  throw new FatalError(
670  "If you use a relative URL for \$$varName, it must start " .
671  'with a slash (<code>/</code>).<br><br>See ' .
672  "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
673  "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
674  );
675  }
676 }
677 
678 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
679 
680 if ( $wgCanonicalServer === false ) {
682 }
683 
684 // Set server name
686 if ( $wgServerName !== false ) {
687  wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
688  . 'not customized. Overwriting $wgServerName.' );
689 }
691 unset( $serverParts );
692 
693 // Set defaults for configuration variables
694 // that are derived from the server name by default
695 // Note: $wgEmergencyContact and $wgPasswordSender may be false or empty string (T104142)
696 if ( !$wgEmergencyContact ) {
697  $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
698 }
699 if ( !$wgPasswordSender ) {
700  $wgPasswordSender = 'apache@' . $wgServerName;
701 }
702 if ( !$wgNoReplyAddress ) {
704 }
705 
706 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
707  $wgSecureLogin = false;
708  wfWarn( 'Secure login was enabled on a server that only supports '
709  . 'HTTP or HTTPS. Disabling secure login.' );
710 }
711 
713 
714 // Now that GlobalFunctions is loaded, set defaults that depend on it.
715 if ( $wgTmpDirectory === false ) {
717 }
718 
719 // We don't use counters anymore. Left here for extensions still
720 // expecting this to exist. Should be removed sometime 1.26 or later.
721 if ( !isset( $wgDisableCounters ) ) {
722  $wgDisableCounters = true;
723 }
724 
725 if ( $wgMainWANCache === false ) {
726  // Setup a WAN cache from $wgMainCacheType with no relayer.
727  // Sites using multiple datacenters can configure a relayer.
728  $wgMainWANCache = 'mediawiki-main-default';
730  'class' => WANObjectCache::class,
731  'cacheId' => $wgMainCacheType
732  ];
733 }
734 
735 if ( $wgSharedDB && $wgSharedTables ) {
736  // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
737  MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
738  array_fill_keys(
740  [
741  'dbname' => $wgSharedDB,
742  'schema' => $wgSharedSchema,
743  'prefix' => $wgSharedPrefix
744  ]
745  )
746  );
747 }
748 
749 Profiler::instance()->scopedProfileOut( $ps_default2 );
750 
751 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' );
752 
753 // Raise the memory limit if it's too low
754 wfMemoryLimit();
755 
761 if ( is_null( $wgLocaltimezone ) ) {
762  Wikimedia\suppressWarnings();
763  $wgLocaltimezone = date_default_timezone_get();
764  Wikimedia\restoreWarnings();
765 }
766 
767 date_default_timezone_set( $wgLocaltimezone );
768 if ( is_null( $wgLocalTZoffset ) ) {
769  $wgLocalTZoffset = date( 'Z' ) / 60;
770 }
771 // The part after the System| is ignored, but rest of MW fills it
772 // out as the local offset.
773 $wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
774 
775 if ( !$wgDBerrorLogTZ ) {
777 }
778 
779 // Initialize the request object in $wgRequest
780 $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
781 // Set user IP/agent information for agent session consistency purposes
782 $cpPosInfo = LBFactory::getCPInfoFromCookieValue(
783  // The cookie has no prefix and is set by MediaWiki::preOutputCommit()
784  $wgRequest->getCookie( 'cpPosIndex', '' ),
785  // Mitigate broken client-side cookie expiration handling (T190082)
786  time() - ChronologyProtector::POSITION_COOKIE_TTL
787 );
788 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
789  'IPAddress' => $wgRequest->getIP(),
790  'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
791  'ChronologyProtection' => $wgRequest->getHeader( 'MediaWiki-Chronology-Protection' ),
792  'ChronologyPositionIndex' => $wgRequest->getInt( 'cpPosIndex', $cpPosInfo['index'] ),
793  'ChronologyClientId' => $cpPosInfo['clientId']
794  ?? $wgRequest->getHeader( 'MediaWiki-Chronology-Client-Id' )
795 ] );
796 unset( $cpPosInfo );
797 // Make sure that object caching does not undermine the ChronologyProtector improvements
798 if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) {
799  // The user is pinned to the primary DC, meaning that they made recent changes which should
800  // be reflected in their subsequent web requests. Avoid the use of interim cache keys because
801  // they use a blind TTL and could be stale if an object changes twice in a short time span.
802  MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching( false );
803 }
804 
805 // Useful debug output
806 if ( $wgCommandLineMode ) {
807  wfDebug( "\n\nStart command line script $self\n" );
808 } else {
809  $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
810 
811  if ( $wgDebugPrintHttpHeaders ) {
812  $debug .= "HTTP HEADERS:\n";
813 
814  foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
815  $debug .= "$name: $value\n";
816  }
817  }
818  wfDebug( $debug );
819 }
820 
823 
824 wfDebugLog( 'caches',
825  'cluster: ' . get_class( $wgMemc ) .
826  ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
827  ', stash: ' . $wgMainStash .
828  ', message: ' . get_class( $messageMemc ) .
829  ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
830 );
831 
832 Profiler::instance()->scopedProfileOut( $ps_misc );
833 
834 // Most of the config is out, some might want to run hooks here.
835 Hooks::run( 'SetupAfterCache' );
836 
837 $ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
838 
843 $wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
844 
845 // Now that variant lists may be available...
846 $wgRequest->interpolateTitle();
847 
853 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
854  // If session.auto_start is there, we can't touch session name
855  if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
856  session_name( $wgSessionName ?: $wgCookiePrefix . '_session' );
857  }
858 
859  // Create the SessionManager singleton and set up our session handler,
860  // unless we're specifically asked not to.
861  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
863  MediaWiki\Session\SessionManager::singleton()
864  );
865  }
866 
867  // Initialize the session
868  try {
870  } catch ( OverflowException $ex ) {
871  if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
872  // The exception is because the request had multiple possible
873  // sessions tied for top priority. Report this to the user.
874  $list = [];
875  foreach ( $ex->sessionInfos as $info ) {
876  $list[] = $info->getProvider()->describe( $wgContLang );
877  }
878  $list = $wgContLang->listToText( $list );
879  throw new HttpError( 400,
880  Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )->plain()
881  );
882  }
883 
884  // Not the one we want, rethrow
885  throw $ex;
886  }
887 
888  if ( $session->isPersistent() ) {
889  $wgInitialSessionId = $session->getSessionId();
890  }
891 
892  $session->renew();
893  if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
894  ( $session->isPersistent() || $session->shouldRememberUser() ) &&
895  session_id() !== $session->getId()
896  ) {
897  // Start the PHP-session for backwards compatibility
898  if ( session_id() !== '' ) {
899  wfDebugLog( 'session', 'PHP session {old_id} was already started, changing to {new_id}', 'all', [
900  'old_id' => session_id(),
901  'new_id' => $session->getId(),
902  ] );
903  session_write_close();
904  }
905  session_id( $session->getId() );
906  session_start();
907  }
908 
909  unset( $session );
910 } else {
911  // Even if we didn't set up a global Session, still install our session
912  // handler unless specifically requested not to.
913  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
915  MediaWiki\Session\SessionManager::singleton()
916  );
917  }
918 }
919 
923 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
924 
929 
933 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
934 
939 $wgParser = new StubObject( 'wgParser', function () {
940  return MediaWikiServices::getInstance()->getParser();
941 } );
942 
947 
948 Profiler::instance()->scopedProfileOut( $ps_globals );
949 $ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
950 
951 // Extension setup functions
952 // Entries should be added to this variable during the inclusion
953 // of the extension file. This allows the extension to perform
954 // any necessary initialisation in the fully initialised environment
955 foreach ( $wgExtensionFunctions as $func ) {
956  call_user_func( $func );
957 }
958 
959 // If the session user has a 0 id but a valid name, that means we need to
960 // autocreate it.
961 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
962  $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
963  if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
964  $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
965  $sessionUser,
966  MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
967  true
968  );
969  \MediaWiki\Logger\LoggerFactory::getInstance( 'authevents' )->info( 'Autocreation attempt', [
970  'event' => 'autocreate',
971  'status' => $res,
972  ] );
973  unset( $res );
974  }
975  unset( $sessionUser );
976 }
977 
978 if ( !$wgCommandLineMode ) {
980 }
981 
983 
984 Profiler::instance()->scopedProfileOut( $ps_extensions );
985 Profiler::instance()->scopedProfileOut( $ps_setup );
$wgInitialSessionId
Definition: Setup.php:852
$wgForeignFileRepos
Enable the use of files from one or more other wikis.
$wgUseInstantCommons
Use Wikimedia Commons as a foreign file repository.
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
$wgNewUserLog
Maintain a log of newusers at Special:Log/newusers?
$wgMainStash
Main object stash type.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
Definition: Setup.php:473
$wgEnotifWatchlist
Definition: Setup.php:435
either a plain
Definition: hooks.txt:2043
$wgScript
The URL path to index.php.
$wgRightsUrl
Set this to specify an external URL containing details about the content license used on your wiki...
$wgDBerrorLogTZ
Timezone to use in the error log.
if( $wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
Definition: Setup.php:376
static getNonstandardLanguageCodeMapping()
Returns a mapping of non-standard language codes used by (current and previous version of) MediaWiki...
$wgSitename
Name of the site.
$wgUserEmailUseReplyTo
Definition: Setup.php:438
$ps_misc
Definition: Setup.php:751
$wgUsersNotifiedOnAllChanges
Definition: Setup.php:439
CACHE_MEMCACHED $wgMainCacheType
Definition: memcached.txt:63
$wgDebugLogGroups
Map of string log group names to log destinations.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:418
$wgEnotifFromEditor
Definition: Setup.php:428
if( $wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Definition: Setup.php:459
$wgParser
Definition: Setup.php:939
$wgGalleryOptions
Default parameters for the "<gallery>" tag.
Definition: Setup.php:265
static instance()
Singleton.
Definition: Profiler.php:62
$wgDBpassword
Database user&#39;s password.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
$wgActionPaths
Definition: img_auth.php:47
$wgDebugToolbar
Display the new debugging toolbar.
$wgThumbnailScriptPath
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating t...
$wgRepositoryBaseUrl
Shortcut for the &#39;descBaseUrl&#39; setting of $wgForeignFileRepos.
bool string $wgSharedUploadDBname
Shortcut for the ForeignDBRepo &#39;dbName&#39; setting in $wgForeignFileRepos.
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
$wgDBtype
Database type.
$wgFileExtensions
Definition: Setup.php:586
bool $wgCacheSharedUploads
Shortcut for the ForeignDBRepo &#39;hasSharedCache&#39; setting in $wgForeignFileRepos.
$wgLocalFileRepo
File repository structures.
$wgSecureLogin
This is to let user authenticate using https when they come from http.
$wgDBmwschema
Mediawiki schema; this should be alphanumeric and not contain spaces nor hyphens. ...
$value
$wgMetaNamespace
Name of the project namespace.
$wgSharedTables
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:92
$wgDBserver
Database host name or IP address.
static getLocalClusterInstance()
Get the main cluster-local cache object.
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
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
$wgDBuser
Database username.
$wgMainWANCache
Main Wide-Area-Network cache type.
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//') $wgVirtualRestConfig['global']['domain']
Definition: Setup.php:712
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
$wgCdnServers
List of proxy servers to purge on changes; default port is 80.
A helper class for throttling authentication attempts.
$wgTmpDirectory
The local filesystem path to a temporary directory.
$wgEnableUserEmail
Definition: Setup.php:427
$wgCdnServersNoPurge
As with $wgCdnServers, except these servers aren&#39;t purged on page changes; use to set a list of trust...
static getMaxUploadSize( $forType=null)
Get the MediaWiki maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
$wgArticlePath
Definition: img_auth.php:46
$wgWANObjectCaches
Advanced WAN object cache configuration.
const NS_TEMPLATE
Definition: Defines.php:74
string $wgSharedUploadDBprefix
Shortcut for the ForeignDBRepo &#39;tablePrefix&#39; setting in $wgForeignFileRepos.
$wgMemc
Definition: Setup.php:821
$wgLogNames
Lists the message key string for each log type.
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
$wgDebugLogFile
Filename for debug logging.
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go...
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
if(!defined( 'MEDIAWIKI')) $wgScopeTest
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
Definition: Setup.php:39
const MW_NO_SESSION
Definition: load.php:29
$wgCacheDirectory
Directory for caching data in the local filesystem.
$wgDebugDumpSql
Write SQL queries to the debug log.
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
$wgGroupPermissions
Permission keys given to users in each group.
NS_SPECIAL
Definition: Setup.php:475
$wgExtraLanguageCodes
List of mappings from one language code to another.
Show an error that looks like an HTTP server error.
Definition: HttpError.php:30
$wgLanguageCode
Site language code.
string $wgSharedUploadPath
Shortcut for the &#39;url&#39; setting of $wgForeignFileRepos.
global $wgCommandLineMode
Definition: Setup.php:651
string $wgSharedThumbnailScriptPath
Shortcut for the &#39;thumbScriptUrl&#39; setting of $wgForeignFileRepos.
$rcMaxAgeDays
Definition: Setup.php:361
foreach([ 'wgArticlePath', 'wgVariantArticlePath'] as $varName) $ps_default2
Definition: Setup.php:678
$wgStylePath
The URL path of the skins directory.
$wgPasswordPolicy
Password policy for the wiki.
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( $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&#39;s too easy for a sysadmin to set $wgName...
Definition: Setup.php:238
const NS_PROJECT
Definition: Defines.php:68
$wgLang
Definition: Setup.php:928
wfTempDir()
Tries to get the system directory for temporary files.
static getMain()
Get the RequestContext object associated with the main request.
const DBO_DEBUG
Definition: defines.php:9
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites...
$wgDeletedDirectory
What directory to place deleted uploads in.
$wgEnotifMaxRecips
Definition: Setup.php:430
static install(SessionManager $manager)
Install a session handler for the current web request.
const NS_MEDIAWIKI_TALK
Definition: Defines.php:73
$wgEnotifUseRealName
Definition: Setup.php:433
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
$ps_default
Definition: Setup.php:138
const NS_PROJECT_TALK
Definition: Defines.php:69
static singleton()
Get the global AuthManager.
const NS_MEDIA
Definition: Defines.php:52
$res
Definition: database.txt:21
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
bool $wgUseSharedUploads
Shortcut for adding an entry to $wgForeignFileRepos.
$wgEnotifRevealEditorAddress
Definition: Setup.php:432
if(is_array( $wgExtraNamespaces)) if(count( $wgDummyLanguageCodes) !==0) $wgDummyLanguageCodes
Definition: Setup.php:503
$wgEnotifUserTalk
Definition: Setup.php:434
$wgUsePathInfo
Whether to support URLs like index.php/Page_title These often break when PHP is set up in CGI mode...
const NS_CATEGORY
Definition: Defines.php:78
$wgResourceBasePath
The default &#39;remoteBasePath&#39; value for instances of ResourceLoaderFileModule.
$wgMaximalPasswordLength
Specifies the maximal length of a user password (T64685).
static newFromKey( $key)
Factory function that is just wrapper for the real constructor.
Definition: Message.php:408
static register()
Register a callback to be called when headers are sent.
$wgProfileOnly
Don&#39;t put non-profiling info into log file.
$wgEnotifMinorEdits
Definition: Setup.php:431
$wgSharedDB
Shared database for multiple wikis.
$wgTitle
Definition: Setup.php:946
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Definition: StubObject.php:45
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:780
$wgCdnMaxAge
Cache TTL for the CDN sent as s-maxage (without ESI) or Surrogate-Control (with ESI).
$messageMemc
Definition: Setup.php:822
$wgRightsText
If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link...
static schedulePingback()
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send...
Definition: Pingback.php:272
$wgSessionName
Override to customise the session name.
const NS_FILE
Definition: Defines.php:70
$GLOBALS['IP']
const NS_FILE_TALK
Definition: Defines.php:71
static detectProtocol()
Detect the protocol from $_SERVER.
Definition: WebRequest.php:246
$wgLocaltimezone
Fake out the timezone that the server thinks it&#39;s in.
static array static array static getDeprecatedCodeMapping()
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up...
$wgRCFilterByAge
Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be store...
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
Definition: Setup.php:251
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
Definition: hooks.txt:780
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
const NS_MEDIAWIKI
Definition: Defines.php:72
const PROTO_HTTP
Definition: Defines.php:219
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings, LocalSettings).
Definition: Setup.php:123
foreach( $wgExtensionFunctions as $func) if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised
Definition: Setup.php:982
$wgJsMimeType
Definition: Setup.php:583
$wgPasswordSender
Sender email address for e-mail notifications.
$wgEmailAuthentication
Definition: Setup.php:426
const MW_CONFIG_CALLBACK
Definition: install.php:26
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
string $wgSharedUploadDirectory
Shortcut for the &#39;directory&#39; setting of $wgForeignFileRepos.
$wgPageCreationLog
Maintain a log of page creations at Special:Log/create?
$wgShellLocale
Locale for LC_ALL, to provide a known environment for locale-sensitive operations.
$wgSessionCacheType
The cache type for storing session data.
$wgUploadPath
The URL path for the images directory.
$wgEmergencyContact
Site admin email address.
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
Definition: Setup.php:245
$wgExtraNamespaces
Additional namespaces.
static getGlobalSession()
Get the "global" session.
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode. ...
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
const DBO_DEFAULT
Definition: defines.php:13
if( $wgCanonicalServer===false) $serverParts
Definition: Setup.php:685
$ps_setup
Definition: Setup.php:124
$wgLocalStylePath
The URL path of the skins directory.
$wgUseEnotif
Definition: Setup.php:437
const NS_CATEGORY_TALK
Definition: Defines.php:79
const NS_HELP
Definition: Defines.php:76
$wgMinimalPasswordLength
Specifies the minimal length of a user password.
static installHandler()
Install handlers with PHP.
static isValidUserName( $name)
Is the input a valid username?
Definition: User.php:1006
if( $wgSkipSkin) $wgSkipSkins[]
Definition: Setup.php:390
const NS_HELP_TALK
Definition: Defines.php:77
bool $wgHashedSharedUploadDirectory
Shortcut for the &#39;hashLevels&#39; setting of $wgForeignFileRepos.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
$wgScriptPath
The path we should point to.
$wgLocalInterwiki
The interwiki prefix of the current wiki, or false if it doesn&#39;t have one.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
Stub object for the user language.
$wgExtensionAssetsPath
The URL path of the extensions directory.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
$ps_globals
Definition: Setup.php:837
$wgDBprefix
Table name prefix.
$cpPosInfo
Definition: Setup.php:782
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
wfMemoryLimit()
Set PHP&#39;s memory limit to the larger of php.ini or $wgMemoryLimit.
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type...
controlled by the following MediaWiki still creates a BagOStuff but calls it to it are no ops If the cache daemon can t be it should also disable itself fairly $wgDBname
Definition: memcached.txt:93
$ps_extensions
Definition: Setup.php:949
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
$wgHashedUploadDirectory
Set this to false if you do not want MediaWiki to divide your images directory into many subdirectori...
$wgLogo
The URL path of the wiki logo.
$wgXhtmlDefaultNamespace
Definition: Setup.php:582
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
static getMaxPhpUploadSize()
Get the PHP maximum uploaded file size, based on ini settings.
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:780
$wgServer
URL of the server.
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
const NS_TALK
Definition: Defines.php:65
if( $wgServerName !==false) $wgServerName
Definition: Setup.php:690
if( $wgUseFileCache|| $wgUseCdn) $wgHtml5
Definition: Setup.php:581
$wgOut
Definition: Setup.php:933
$wgSharedPrefix
$wgEnotifImpersonal
Definition: Setup.php:429
$wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
$wgUploadBaseUrl
If set, this URL is added to the start of $wgUploadPath to form a complete upload URL...
$wgRCLinkDays
List of Days options to list in the Special:Recentchanges and Special:Recentchangeslinked pages...
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
const CACHE_NONE
Definition: Defines.php:102
$wgResourceLoaderMaxQueryLength
If set to a positive number, ResourceLoader will not generate URLs whose query string is more than th...
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
$debug
Definition: mcc.php:31
$wgDebugPrintHttpHeaders
Print HTTP headers for every request in the debug information.
$wgRightsIcon
Override for copyright metadata.
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
const NS_USER_TALK
Definition: Defines.php:67
$wgSharedSchema
$wgLoadScript
The URL path to load.php.
$wgNoReplyAddress
Reply-To address for e-mail notifications.
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
$wgFileCacheDirectory
Directory where the cached page will be saved.
static init()
Enabled the debugger and load resource module.
Definition: MWDebug.php:76
bool $wgFetchCommonsDescriptions
Shortcut for the &#39;fetchDescription&#39; setting of $wgForeignFileRepos.
$wgUseCdn
Enable/disable CDN.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
if(is_array( $wgExtraNamespaces)) if(count( $wgDummyLanguageCodes) !==0) foreach(LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode
Definition: Setup.php:519
$wgUploadDirectory
The filesystem path of the images directory.
const NS_TEMPLATE_TALK
Definition: Defines.php:75
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
$wgContLang
Definition: Setup.php:843