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 global constants
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 
96 // Install a header callback
98 
99 // Set the encoding used by reading HTTP input, writing HTTP output.
100 // This is also the default for mbstring functions.
101 mb_internal_encoding( 'UTF-8' );
102 
107 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
108  call_user_func( MW_CONFIG_CALLBACK );
109 } else {
110  if ( !defined( 'MW_CONFIG_FILE' ) ) {
111  define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
112  }
113  require_once MW_CONFIG_FILE;
114 }
115 
123 if ( defined( 'MW_SETUP_CALLBACK' ) ) {
124  call_user_func( MW_SETUP_CALLBACK );
125 }
126 
131 $fname = 'Setup.php';
132 $ps_setup = Profiler::instance()->scopedProfileIn( $fname );
133 
134 // Load queued extensions
135 ExtensionRegistry::getInstance()->loadFromQueue();
136 // Don't let any other extensions load
138 
139 // Set the configured locale on all requests for consisteny
140 putenv( "LC_ALL=$wgShellLocale" );
141 setlocale( LC_ALL, $wgShellLocale );
142 
143 // Set various default paths sensibly...
144 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
145 
146 if ( $wgScript === false ) {
147  $wgScript = "$wgScriptPath/index.php";
148 }
149 if ( $wgLoadScript === false ) {
150  $wgLoadScript = "$wgScriptPath/load.php";
151 }
152 if ( $wgRestPath === false ) {
153  $wgRestPath = "$wgScriptPath/rest.php";
154 }
155 
156 if ( $wgArticlePath === false ) {
157  if ( $wgUsePathInfo ) {
158  $wgArticlePath = "$wgScript/$1";
159  } else {
160  $wgArticlePath = "$wgScript?title=$1";
161  }
162 }
163 
164 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
165  // 'view' is assumed the default action path everywhere in the code
166  // but is rarely filled in $wgActionPaths
167  $wgActionPaths['view'] = $wgArticlePath;
168 }
169 
170 if ( $wgResourceBasePath === null ) {
172 }
173 if ( $wgStylePath === false ) {
174  $wgStylePath = "$wgResourceBasePath/skins";
175 }
176 if ( $wgLocalStylePath === false ) {
177  // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN)
178  $wgLocalStylePath = "$wgScriptPath/skins";
179 }
180 if ( $wgExtensionAssetsPath === false ) {
181  $wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
182 }
183 
184 if ( $wgLogo === false ) {
185  $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
186 }
187 
188 if ( $wgUploadPath === false ) {
189  $wgUploadPath = "$wgScriptPath/images";
190 }
191 if ( $wgUploadDirectory === false ) {
192  $wgUploadDirectory = "$IP/images";
193 }
194 if ( $wgReadOnlyFile === false ) {
195  $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
196 }
197 if ( $wgFileCacheDirectory === false ) {
198  $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
199 }
200 if ( $wgDeletedDirectory === false ) {
201  $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
202 }
203 
204 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
205  $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
206 }
207 
208 // Fix path to icon images after they were moved in 1.24
209 if ( $wgRightsIcon ) {
210  $wgRightsIcon = str_replace(
211  "{$wgStylePath}/common/images/",
212  "{$wgResourceBasePath}/resources/assets/licenses/",
214  );
215 }
216 
217 if ( isset( $wgFooterIcons['copyright']['copyright'] )
218  && $wgFooterIcons['copyright']['copyright'] === []
219 ) {
220  if ( $wgRightsIcon || $wgRightsText ) {
221  $wgFooterIcons['copyright']['copyright'] = [
222  'url' => $wgRightsUrl,
223  'src' => $wgRightsIcon,
224  'alt' => $wgRightsText,
225  ];
226  }
227 }
228 
229 if ( isset( $wgFooterIcons['poweredby'] )
230  && isset( $wgFooterIcons['poweredby']['mediawiki'] )
231  && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
232 ) {
233  $wgFooterIcons['poweredby']['mediawiki']['src'] =
234  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
235  $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
236  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
237  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
238 }
239 
248 
256 
261  'name' => 'fsLockManager',
262  'class' => FSLockManager::class,
263  'lockDirectory' => "{$wgUploadDirectory}/lockdir",
264 ];
265 $wgLockManagers[] = [
266  'name' => 'nullLockManager',
267  'class' => NullLockManager::class,
268 ];
269 
275  'imagesPerRow' => 0,
276  'imageWidth' => 120,
277  'imageHeight' => 120,
278  'captionLength' => true,
279  'showBytes' => true,
280  'showDimensions' => true,
281  'mode' => 'traditional',
282 ];
283 
287 if ( !$wgLocalFileRepo ) {
288  $wgLocalFileRepo = [
289  'class' => LocalRepo::class,
290  'name' => 'local',
291  'directory' => $wgUploadDirectory,
292  'scriptDirUrl' => $wgScriptPath,
294  'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
295  'thumbScriptUrl' => $wgThumbnailScriptPath,
296  'transformVia404' => !$wgGenerateThumbnailOnParse,
297  'deletedDir' => $wgDeletedDirectory,
298  'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
299  ];
300 }
301 
302 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
303  // Create a default FileBackend name.
304  // FileBackendGroup will register a default, if absent from $wgFileBackends.
305  $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
306 }
307 
311 if ( $wgUseSharedUploads ) {
312  if ( $wgSharedUploadDBname ) {
313  $wgForeignFileRepos[] = [
314  'class' => ForeignDBRepo::class,
315  'name' => 'shared',
316  'directory' => $wgSharedUploadDirectory,
317  'url' => $wgSharedUploadPath,
318  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
319  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
320  'transformVia404' => !$wgGenerateThumbnailOnParse,
321  'dbType' => $wgDBtype,
322  'dbServer' => $wgDBserver,
323  'dbUser' => $wgDBuser,
324  'dbPassword' => $wgDBpassword,
325  'dbName' => $wgSharedUploadDBname,
326  'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
327  'tablePrefix' => $wgSharedUploadDBprefix,
328  'hasSharedCache' => $wgCacheSharedUploads,
329  'descBaseUrl' => $wgRepositoryBaseUrl,
330  'fetchDescription' => $wgFetchCommonsDescriptions,
331  ];
332  } else {
333  $wgForeignFileRepos[] = [
334  'class' => FileRepo::class,
335  'name' => 'shared',
336  'directory' => $wgSharedUploadDirectory,
337  'url' => $wgSharedUploadPath,
338  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
339  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
340  'transformVia404' => !$wgGenerateThumbnailOnParse,
341  'descBaseUrl' => $wgRepositoryBaseUrl,
342  'fetchDescription' => $wgFetchCommonsDescriptions,
343  ];
344  }
345 }
346 if ( $wgUseInstantCommons ) {
347  $wgForeignFileRepos[] = [
348  'class' => ForeignAPIRepo::class,
349  'name' => 'wikimediacommons',
350  'apibase' => 'https://commons.wikimedia.org/w/api.php',
351  'url' => 'https://upload.wikimedia.org/wikipedia/commons',
352  'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
353  'hashLevels' => 2,
354  'transformVia404' => true,
355  'fetchDescription' => true,
356  'descriptionCacheExpiry' => 43200,
357  'apiThumbCacheExpiry' => 0,
358  ];
359 }
360 foreach ( $wgForeignFileRepos as &$repo ) {
361  if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) {
362  $repo['directory'] = $wgUploadDirectory; // b/c
363  }
364  if ( !isset( $repo['backend'] ) ) {
365  $repo['backend'] = $repo['name'] . '-backend';
366  }
367 }
368 unset( $repo ); // no global pollution; destroy reference
369 
370 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
371 if ( $wgRCFilterByAge ) {
372  // Trim down $wgRCLinkDays so that it only lists links which are valid
373  // as determined by $wgRCMaxAge.
374  // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
375  sort( $wgRCLinkDays );
376 
377  foreach ( $wgRCLinkDays as $i => $days ) {
378  if ( $days >= $rcMaxAgeDays ) {
379  array_splice( $wgRCLinkDays, $i + 1 );
380  break;
381  }
382  }
383 }
384 // Ensure that default user options are not invalid, since that breaks Special:Preferences
385 $wgDefaultUserOptions['rcdays'] = min(
386  $wgDefaultUserOptions['rcdays'],
387  ceil( $rcMaxAgeDays )
388 );
389 $wgDefaultUserOptions['watchlistdays'] = min(
390  $wgDefaultUserOptions['watchlistdays'],
391  ceil( $rcMaxAgeDays )
392 );
393 unset( $rcMaxAgeDays );
394 
395 if ( $wgSkipSkin ) {
396  // Hard deprecated in 1.34.
397  wfDeprecated( '$wgSkipSkin – use $wgSkipSkins instead', '1.23' );
399 }
400 
401 $wgSkipSkins[] = 'fallback';
402 $wgSkipSkins[] = 'apioutput';
403 
404 if ( $wgLocalInterwiki ) {
405  // Hard deprecated in 1.34.
406  wfDeprecated( '$wgLocalInterwiki – use $wgLocalInterwikis instead', '1.23' );
407  array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
408 }
409 
410 // Set default shared prefix
411 if ( $wgSharedPrefix === false ) {
413 }
414 
415 // Set default shared schema
416 if ( $wgSharedSchema === false ) {
418 }
419 
420 if ( !$wgCookiePrefix ) {
421  if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
423  } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
425  } elseif ( $wgDBprefix ) {
427  } else {
429  }
430 }
431 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
432 
433 if ( $wgEnableEmail ) {
435 } else {
436  // Disable all other email settings automatically if $wgEnableEmail
437  // is set to false. - T65678
438  $wgAllowHTMLEmail = false;
439  $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
449  unset( $wgGroupPermissions['user']['sendemail'] );
450  $wgUseEnotif = false;
453 }
454 
455 if ( $wgMetaNamespace === false ) {
456  $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
457 }
458 
459 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
460 if ( $wgResourceLoaderMaxQueryLength === false ) {
461  $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
462  if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
463  $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
464  } else {
466  }
467  unset( $suhosinMaxValueLength );
468 }
469 
470 // Ensure the minimum chunk size is less than PHP upload limits or the maximum
471 // upload size.
477  ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
478  PHP_INT_MAX
479  ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
480 );
481 
487  NS_MEDIA => 'Media',
488  NS_SPECIAL => 'Special',
489  NS_TALK => 'Talk',
490  NS_USER => 'User',
491  NS_USER_TALK => 'User_talk',
492  NS_PROJECT => 'Project',
493  NS_PROJECT_TALK => 'Project_talk',
494  NS_FILE => 'File',
495  NS_FILE_TALK => 'File_talk',
496  NS_MEDIAWIKI => 'MediaWiki',
497  NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
498  NS_TEMPLATE => 'Template',
499  NS_TEMPLATE_TALK => 'Template_talk',
500  NS_HELP => 'Help',
501  NS_HELP_TALK => 'Help_talk',
502  NS_CATEGORY => 'Category',
503  NS_CATEGORY_TALK => 'Category_talk',
504 ];
505 
507 if ( is_array( $wgExtraNamespaces ) ) {
509 }
510 
511 // Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php
512 if ( count( $wgDummyLanguageCodes ) !== 0 ) {
513  wfDeprecated( '$wgDummyLanguageCodes', '1.29' );
514 }
515 // Merge in the legacy language codes, incorporating overrides from the config
517  // Internal language codes of the private-use area which get mapped to
518  // themselves.
519  'qqq' => 'qqq', // Used for message documentation
520  'qqx' => 'qqx', // Used for viewing message keys
522 // Merge in (inverted) BCP 47 mappings
524  $bcp47 = strtolower( $bcp47 ); // force case-insensitivity
525  if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) {
527  }
528 }
529 
530 // These are now the same, always
531 // To determine the user language, use $wgLang->getCode()
533 
534 // Temporary backwards-compatibility reading of old Squid-named CDN settings as of MediaWiki 1.34,
535 // to support sysadmins who fail to update their settings immediately:
536 
537 if ( isset( $wgUseSquid ) ) {
538  // If the sysadmin is still setting a value of $wgUseSquid to true but $wgUseCdn is the default of
539  // false, to be safe, assume they do want this still, so enable it.
540  if ( !$wgUseCdn && $wgUseSquid ) {
541  $wgUseCdn = $wgUseSquid;
542  wfDeprecated( '$wgUseSquid enabled but $wgUseCdn disabled; enabling CDN functions', '1.34' );
543  }
544 } else {
545  // Backwards-compatibility for extensions that read this value.
546  $wgUseSquid = $wgUseCdn;
547 }
548 
549 if ( isset( $wgSquidServers ) ) {
550  // If the sysadmin is still setting a value of $wgSquidServers but $wgCdnServers is the default of
551  // empty, to be safe, assume they do want these servers to be still used, so use them.
552  if ( !empty( $wgSquidServers ) && empty( $wgCdnServers ) ) {
553  $wgCdnServers = $wgSquidServers;
554  wfDeprecated( '$wgSquidServers set, $wgCdnServers empty; using them', '1.34' );
555  }
556 } else {
557  // Backwards-compatibility for extensions that read this value.
558  $wgSquidServers = $wgCdnServers;
559 }
560 
561 if ( isset( $wgSquidServersNoPurge ) ) {
562  // If the sysadmin is still setting values in $wgSquidServersNoPurge but $wgCdnServersNoPurge is
563  // the default of empty, to be safe, assume they do want these servers to be still used, so use
564  // them.
565  if ( !empty( $wgSquidServersNoPurge ) && empty( $wgCdnServersNoPurge ) ) {
566  $wgCdnServersNoPurge = $wgSquidServersNoPurge;
567  wfDeprecated( '$wgSquidServersNoPurge set, $wgCdnServersNoPurge empty; using them', '1.34' );
568  }
569 } else {
570  // Backwards-compatibility for extensions that read this value.
571  $wgSquidServersNoPurge = $wgCdnServersNoPurge;
572 }
573 
574 if ( isset( $wgSquidMaxage ) ) {
575  // If the sysadmin is still setting a value of $wgSquidMaxage and it's higher than $wgCdnMaxAge,
576  // to be safe, assume they want the higher (lower performance requirement) value, so use that.
577  if ( $wgCdnMaxAge < $wgSquidMaxage ) {
578  $wgCdnMaxAge = $wgSquidMaxage;
579  wfDeprecated( '$wgSquidMaxage set higher than $wgCdnMaxAge; using the higher value', '1.34' );
580  }
581 } else {
582  // Backwards-compatibility for extensions that read this value.
583  $wgSquidMaxage = $wgCdnMaxAge;
584 }
585 
586 // Easy to forget to falsify $wgDebugToolbar for static caches.
587 // If file cache or CDN cache is on, just disable this (DWIMD).
588 if ( $wgUseFileCache || $wgUseCdn ) {
589  $wgDebugToolbar = false;
590 }
591 
592 // Blacklisted file extensions shouldn't appear on the "allowed" list
593 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
594 
596  Wikimedia\suppressWarnings();
597  $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
598  Wikimedia\restoreWarnings();
599 }
600 
601 if ( $wgNewUserLog ) {
602  // Add new user log type
603  $wgLogTypes[] = 'newusers';
604  $wgLogNames['newusers'] = 'newuserlogpage';
605  $wgLogHeaders['newusers'] = 'newuserlogpagetext';
606  $wgLogActionsHandlers['newusers/newusers'] = NewUsersLogFormatter::class;
610  $wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class;
611 }
612 
613 if ( $wgPageCreationLog ) {
614  // Add page creation log type
615  $wgLogTypes[] = 'create';
616  $wgLogActionsHandlers['create/create'] = LogFormatter::class;
617 }
618 
619 if ( $wgPageLanguageUseDB ) {
620  $wgLogTypes[] = 'pagelang';
621  $wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class;
622 }
623 
624 if ( $wgCookieSecure === 'detect' ) {
625  $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
626 }
627 
628 if ( $wgProfileOnly ) {
629  // Hard deprecated in 1.34.
630  wfDeprecated(
631  '$wgProfileOnly set the log file in $wgDebugLogGroups[\'profileoutput\'] instead',
632  '1.23'
633  );
634  $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
635  $wgDebugLogFile = '';
636 }
637 
638 // Backwards compatibility with old password limits
639 if ( $wgMinimalPasswordLength !== false ) {
640  $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
641 }
642 
643 if ( $wgMaximalPasswordLength !== false ) {
644  $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
645 }
646 
647 if ( $wgPHPSessionHandling !== 'enable' &&
648  $wgPHPSessionHandling !== 'warn' &&
649  $wgPHPSessionHandling !== 'disable'
650 ) {
651  $wgPHPSessionHandling = 'warn';
652 }
653 if ( defined( 'MW_NO_SESSION' ) ) {
654  // If the entry point wants no session, force 'disable' here unless they
655  // specifically set it to the (undocumented) 'warn'.
656  $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
657 }
658 
659 Profiler::instance()->scopedProfileOut( $ps_default );
660 
661 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
662 // all the memory from logging SQL queries on maintenance scripts
664 if ( $wgDebugToolbar && !$wgCommandLineMode ) {
665  MWDebug::init();
666 }
667 
668 // Reset the global service locator, so any services that have already been created will be
669 // re-created while taking into account any custom settings and extensions.
670 MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
671 
672 // Define a constant that indicates that the bootstrapping of the service locator
673 // is complete.
674 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
675 
677 
678 // T48998: Bail out early if $wgArticlePath is non-absolute
679 foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) {
680  if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
681  throw new FatalError(
682  "If you use a relative URL for \$$varName, it must start " .
683  'with a slash (<code>/</code>).<br><br>See ' .
684  "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
685  "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
686  );
687  }
688 }
689 
690 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
691 
692 if ( $wgCanonicalServer === false ) {
694 }
695 
696 // Set server name
698 if ( $wgServerName !== false ) {
699  wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
700  . 'not customized. Overwriting $wgServerName.' );
701 }
703 unset( $serverParts );
704 
705 // Set defaults for configuration variables
706 // that are derived from the server name by default
707 // Note: $wgEmergencyContact and $wgPasswordSender may be false or empty string (T104142)
708 if ( !$wgEmergencyContact ) {
709  $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
710 }
711 if ( !$wgPasswordSender ) {
712  $wgPasswordSender = 'apache@' . $wgServerName;
713 }
714 if ( !$wgNoReplyAddress ) {
716 }
717 
718 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
719  $wgSecureLogin = false;
720  wfWarn( 'Secure login was enabled on a server that only supports '
721  . 'HTTP or HTTPS. Disabling secure login.' );
722 }
723 
725 
726 // Now that GlobalFunctions is loaded, set defaults that depend on it.
727 if ( $wgTmpDirectory === false ) {
729 }
730 
731 // We don't use counters anymore. Left here for extensions still
732 // expecting this to exist. Should be removed sometime 1.26 or later.
733 if ( !isset( $wgDisableCounters ) ) {
734  $wgDisableCounters = true;
735 }
736 
737 if ( $wgMainWANCache === false ) {
738  // Setup a WAN cache from $wgMainCacheType with no relayer.
739  // Sites using multiple datacenters can configure a relayer.
740  $wgMainWANCache = 'mediawiki-main-default';
742  'class' => WANObjectCache::class,
743  'cacheId' => $wgMainCacheType
744  ];
745 }
746 
747 if ( $wgSharedDB && $wgSharedTables ) {
748  // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
749  MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
750  array_fill_keys(
752  [
753  'dbname' => $wgSharedDB,
754  'schema' => $wgSharedSchema,
755  'prefix' => $wgSharedPrefix
756  ]
757  )
758  );
759 }
760 
761 Profiler::instance()->scopedProfileOut( $ps_default2 );
762 
763 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' );
764 
765 // Raise the memory limit if it's too low
766 // Note, this makes use of wfDebug, and thus should not be before
767 // MWDebug::init() is called.
769 
775 if ( is_null( $wgLocaltimezone ) ) {
776  Wikimedia\suppressWarnings();
777  $wgLocaltimezone = date_default_timezone_get();
778  Wikimedia\restoreWarnings();
779 }
780 
781 date_default_timezone_set( $wgLocaltimezone );
782 if ( is_null( $wgLocalTZoffset ) ) {
783  $wgLocalTZoffset = date( 'Z' ) / 60;
784 }
785 // The part after the System| is ignored, but rest of MW fills it
786 // out as the local offset.
787 $wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
788 
789 if ( !$wgDBerrorLogTZ ) {
791 }
792 
793 // Initialize the request object in $wgRequest
794 $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
795 // Set user IP/agent information for agent session consistency purposes
796 $cpPosInfo = LBFactory::getCPInfoFromCookieValue(
797  // The cookie has no prefix and is set by MediaWiki::preOutputCommit()
798  $wgRequest->getCookie( 'cpPosIndex', '' ),
799  // Mitigate broken client-side cookie expiration handling (T190082)
800  time() - ChronologyProtector::POSITION_COOKIE_TTL
801 );
802 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
803  'IPAddress' => $wgRequest->getIP(),
804  'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
805  'ChronologyProtection' => $wgRequest->getHeader( 'MediaWiki-Chronology-Protection' ),
806  'ChronologyPositionIndex' => $wgRequest->getInt( 'cpPosIndex', $cpPosInfo['index'] ),
807  'ChronologyClientId' => $cpPosInfo['clientId']
808  ?? $wgRequest->getHeader( 'MediaWiki-Chronology-Client-Id' )
809 ] );
810 unset( $cpPosInfo );
811 // Make sure that object caching does not undermine the ChronologyProtector improvements
812 if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) {
813  // The user is pinned to the primary DC, meaning that they made recent changes which should
814  // be reflected in their subsequent web requests. Avoid the use of interim cache keys because
815  // they use a blind TTL and could be stale if an object changes twice in a short time span.
816  MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching( false );
817 }
818 
819 // Useful debug output
820 if ( $wgCommandLineMode ) {
821  if ( isset( $self ) ) {
822  wfDebug( "\n\nStart command line script $self\n" );
823  }
824 } else {
825  $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
826  $debug .= "HTTP HEADERS:\n";
827  foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
828  $debug .= "$name: $value\n";
829  }
830  wfDebug( $debug );
831 }
832 
835 
836 wfDebugLog( 'caches',
837  'cluster: ' . get_class( $wgMemc ) .
838  ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
839  ', stash: ' . $wgMainStash .
840  ', message: ' . get_class( $messageMemc ) .
841  ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
842 );
843 
844 Profiler::instance()->scopedProfileOut( $ps_misc );
845 
846 // Most of the config is out, some might want to run hooks here.
847 Hooks::run( 'SetupAfterCache' );
848 
849 $ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
850 
855 $wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
856 
857 // Now that variant lists may be available...
858 $wgRequest->interpolateTitle();
859 
865 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
866  // If session.auto_start is there, we can't touch session name
867  if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
868  session_name( $wgSessionName ?: $wgCookiePrefix . '_session' );
869  }
870 
871  // Create the SessionManager singleton and set up our session handler,
872  // unless we're specifically asked not to.
873  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
875  MediaWiki\Session\SessionManager::singleton()
876  );
877  }
878 
879  // Initialize the session
880  try {
882  } catch ( OverflowException $ex ) {
883  if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
884  // The exception is because the request had multiple possible
885  // sessions tied for top priority. Report this to the user.
886  $list = [];
887  foreach ( $ex->sessionInfos as $info ) {
888  $list[] = $info->getProvider()->describe( $wgContLang );
889  }
890  $list = $wgContLang->listToText( $list );
891  throw new HttpError( 400,
892  Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )->plain()
893  );
894  }
895 
896  // Not the one we want, rethrow
897  throw $ex;
898  }
899 
900  if ( $session->isPersistent() ) {
901  $wgInitialSessionId = $session->getSessionId();
902  }
903 
904  $session->renew();
905  if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
906  ( $session->isPersistent() || $session->shouldRememberUser() ) &&
907  session_id() !== $session->getId()
908  ) {
909  // Start the PHP-session for backwards compatibility
910  if ( session_id() !== '' ) {
911  wfDebugLog( 'session', 'PHP session {old_id} was already started, changing to {new_id}', 'all', [
912  'old_id' => session_id(),
913  'new_id' => $session->getId(),
914  ] );
915  session_write_close();
916  }
917  session_id( $session->getId() );
918  session_start();
919  }
920 
921  unset( $session );
922 } else {
923  // Even if we didn't set up a global Session, still install our session
924  // handler unless specifically requested not to.
925  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
927  MediaWiki\Session\SessionManager::singleton()
928  );
929  }
930 }
931 
935 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
936 
941 
945 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
946 
951 $wgParser = new StubObject( 'wgParser', function () {
952  return MediaWikiServices::getInstance()->getParser();
953 } );
954 
959 
960 Profiler::instance()->scopedProfileOut( $ps_globals );
961 $ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
962 
963 // Extension setup functions
964 // Entries should be added to this variable during the inclusion
965 // of the extension file. This allows the extension to perform
966 // any necessary initialisation in the fully initialised environment
967 foreach ( $wgExtensionFunctions as $func ) {
968  call_user_func( $func );
969 }
970 
971 // If the session user has a 0 id but a valid name, that means we need to
972 // autocreate it.
973 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
974  $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
975  if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
976  $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
977  $sessionUser,
978  MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
979  true
980  );
981  \MediaWiki\Logger\LoggerFactory::getInstance( 'authevents' )->info( 'Autocreation attempt', [
982  'event' => 'autocreate',
983  'status' => $res,
984  ] );
985  unset( $res );
986  }
987  unset( $sessionUser );
988 }
989 
990 if ( !$wgCommandLineMode ) {
992 }
993 
995 
996 Profiler::instance()->scopedProfileOut( $ps_extensions );
997 Profiler::instance()->scopedProfileOut( $ps_setup );
$wgInitialSessionId
Definition: Setup.php:864
$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
The object store type of the main stash.
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:486
$wgEnotifWatchlist
Definition: Setup.php:448
either a plain
Definition: hooks.txt:2033
$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:385
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:451
$ps_misc
Definition: Setup.php:763
$wgUsersNotifiedOnAllChanges
Definition: Setup.php:452
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
static install(SessionManagerInterface $manager)
Install a session handler for the current web request.
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:431
$wgEnotifFromEditor
Definition: Setup.php:441
if( $wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Definition: Setup.php:472
$wgParser
Definition: Setup.php:951
$wgGalleryOptions
Default parameters for the "<gallery>" tag.
Definition: Setup.php:274
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.
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:724
$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:440
$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
const MW_CONFIG_FILE
Definition: bootstrap.php:53
$wgWANObjectCaches
Advanced WAN object cache configuration.
const NS_TEMPLATE
Definition: Defines.php:70
string $wgSharedUploadDBprefix
Shortcut for the ForeignDBRepo &#39;tablePrefix&#39; setting in $wgForeignFileRepos.
$wgMemc
Definition: Setup.php:833
$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:488
$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:663
string $wgSharedThumbnailScriptPath
Shortcut for the &#39;thumbScriptUrl&#39; setting of $wgForeignFileRepos.
$rcMaxAgeDays
Definition: Setup.php:370
foreach([ 'wgArticlePath', 'wgVariantArticlePath'] as $varName) $ps_default2
Definition: Setup.php:690
$wgStylePath
The URL path of the skins directory.
$wgPasswordPolicy
Password policy for the wiki.
const NS_PROJECT
Definition: Defines.php:64
$wgLang
Definition: Setup.php:940
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:443
const NS_MEDIAWIKI_TALK
Definition: Defines.php:69
$wgEnotifUseRealName
Definition: Setup.php:446
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
$ps_default
Definition: Setup.php:144
const NS_PROJECT_TALK
Definition: Defines.php:65
static singleton()
Get the global AuthManager.
$self
const NS_MEDIA
Definition: Defines.php:48
$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:445
if(is_array( $wgExtraNamespaces)) if(count( $wgDummyLanguageCodes) !==0) $wgDummyLanguageCodes
Definition: Setup.php:516
$wgEnotifUserTalk
Definition: Setup.php:447
$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:74
$wgResourceBasePath
The default &#39;remoteBasePath&#39; value for instances of ResourceLoaderFileModule.
$wgRestPath
The URL path to the REST API Defaults to "{$wgScriptPath}/rest.php".
$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:410
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:444
$wgSharedDB
Shared database for multiple wikis.
wfMemoryLimit( $newLimit)
Raise PHP&#39;s memory limit (if needed).
$wgTitle
Definition: Setup.php:958
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:767
$wgCdnMaxAge
Cache TTL for the CDN sent as s-maxage (without ESI) or Surrogate-Control (with ESI).
if( $wgUseFileCache|| $wgUseCdn) $wgFileExtensions
Definition: Setup.php:593
$messageMemc
Definition: Setup.php:834
$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:66
$GLOBALS['IP']
const NS_FILE_TALK
Definition: Defines.php:67
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:260
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:767
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:68
const PROTO_HTTP
Definition: Defines.php:199
$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:131
foreach( $wgExtensionFunctions as $func) if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised
Definition: Setup.php:994
$wgPasswordSender
Sender email address for e-mail notifications.
$wgEmailAuthentication
Definition: Setup.php:439
const MW_CONFIG_CALLBACK
Definition: install.php:26
Exception class which takes an HTML error message, and does not produce a backtrace.
Definition: FatalError.php:28
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.
$wgMemoryLimit
The minimum amount of memory that MediaWiki "needs"; MediaWiki will try to raise PHP&#39;s memory limit i...
$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:254
$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:697
$ps_setup
Definition: Setup.php:132
$wgLocalStylePath
The URL path of the skins directory.
$wgUseEnotif
Definition: Setup.php:450
const NS_CATEGORY_TALK
Definition: Defines.php:75
const NS_HELP
Definition: Defines.php:72
$debug
Definition: Setup.php:826
$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:952
if( $wgSkipSkin) $wgSkipSkins[]
Definition: Setup.php:401
const NS_HELP_TALK
Definition: Defines.php:73
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:849
$wgDBprefix
Table name prefix.
$cpPosInfo
Definition: Setup.php:796
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type...
$ps_extensions
Definition: Setup.php:961
$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.
$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:794
$wgServer
URL of the server.
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
const NS_TALK
Definition: Defines.php:61
if( $wgServerName !==false) $wgServerName
Definition: Setup.php:702
$wgOut
Definition: Setup.php:945
$wgSharedPrefix
$wgEnotifImpersonal
Definition: Setup.php:442
$wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a 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
$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:82
$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)
$wgRightsIcon
Override for copyright metadata.
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
const NS_USER_TALK
Definition: Defines.php:63
$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
if( $wgScript===false) if( $wgLoadScript===false) if( $wgRestPath===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:247
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:532
$wgUploadDirectory
The filesystem path of the images directory.
const NS_TEMPLATE_TALK
Definition: Defines.php:71
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
$wgContLang
Definition: Setup.php:855