MediaWiki  1.32.0
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 }
71 
72 // Assert that composer dependencies were successfully loaded
73 // Purposely no leading \ due to it breaking HHVM RepoAuthorative mode
74 // PHP works fine with both versions
75 // See https://github.com/facebook/hhvm/issues/5833
76 if ( !interface_exists( 'Psr\Log\LoggerInterface' ) ) {
77  $message = (
78  'MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging ' .
79  "library</a> to be present. This library is not embedded directly in MediaWiki's " .
80  "git repository and must be installed separately by the end user.\n\n" .
81  'Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git' .
82  '#Fetch_external_libraries">mediawiki.org</a> for help on installing ' .
83  'the required components.'
84  );
85  echo $message;
86  trigger_error( $message, E_USER_ERROR );
87  die( 1 );
88 }
89 
90 // Install a header callback
92 
97 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
98  call_user_func( MW_CONFIG_CALLBACK );
99 } else {
100  if ( !defined( 'MW_CONFIG_FILE' ) ) {
101  define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
102  }
103  require_once MW_CONFIG_FILE;
104 }
105 
113 if ( defined( 'MW_SETUP_CALLBACK' ) ) {
114  call_user_func( MW_SETUP_CALLBACK );
115 }
116 
121 $fname = 'Setup.php';
122 $ps_setup = Profiler::instance()->scopedProfileIn( $fname );
123 
124 // Load queued extensions
125 ExtensionRegistry::getInstance()->loadFromQueue();
126 // Don't let any other extensions load
128 
129 mb_internal_encoding( 'UTF-8' );
130 
131 // Set the configured locale on all requests for consisteny
132 putenv( "LC_ALL=$wgShellLocale" );
133 setlocale( LC_ALL, $wgShellLocale );
134 
135 // Set various default paths sensibly...
136 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
137 
138 if ( $wgScript === false ) {
139  $wgScript = "$wgScriptPath/index.php";
140 }
141 if ( $wgLoadScript === false ) {
142  $wgLoadScript = "$wgScriptPath/load.php";
143 }
144 
145 if ( $wgArticlePath === false ) {
146  if ( $wgUsePathInfo ) {
147  $wgArticlePath = "$wgScript/$1";
148  } else {
149  $wgArticlePath = "$wgScript?title=$1";
150  }
151 }
152 
153 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
154  // 'view' is assumed the default action path everywhere in the code
155  // but is rarely filled in $wgActionPaths
156  $wgActionPaths['view'] = $wgArticlePath;
157 }
158 
159 if ( $wgResourceBasePath === null ) {
161 }
162 if ( $wgStylePath === false ) {
163  $wgStylePath = "$wgResourceBasePath/skins";
164 }
165 if ( $wgLocalStylePath === false ) {
166  // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN)
167  $wgLocalStylePath = "$wgScriptPath/skins";
168 }
169 if ( $wgExtensionAssetsPath === false ) {
170  $wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
171 }
172 
173 if ( $wgLogo === false ) {
174  $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
175 }
176 
177 if ( $wgUploadPath === false ) {
178  $wgUploadPath = "$wgScriptPath/images";
179 }
180 if ( $wgUploadDirectory === false ) {
181  $wgUploadDirectory = "$IP/images";
182 }
183 if ( $wgReadOnlyFile === false ) {
184  $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
185 }
186 if ( $wgFileCacheDirectory === false ) {
187  $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
188 }
189 if ( $wgDeletedDirectory === false ) {
190  $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
191 }
192 
193 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
194  $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
195 }
196 
197 if ( $wgEnableParserCache === false ) {
199 }
200 
201 // Fix path to icon images after they were moved in 1.24
202 if ( $wgRightsIcon ) {
203  $wgRightsIcon = str_replace(
204  "{$wgStylePath}/common/images/",
205  "{$wgResourceBasePath}/resources/assets/licenses/",
207  );
208 }
209 
210 if ( isset( $wgFooterIcons['copyright']['copyright'] )
211  && $wgFooterIcons['copyright']['copyright'] === []
212 ) {
213  if ( $wgRightsIcon || $wgRightsText ) {
214  $wgFooterIcons['copyright']['copyright'] = [
215  'url' => $wgRightsUrl,
216  'src' => $wgRightsIcon,
217  'alt' => $wgRightsText,
218  ];
219  }
220 }
221 
222 if ( isset( $wgFooterIcons['poweredby'] )
223  && isset( $wgFooterIcons['poweredby']['mediawiki'] )
224  && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
225 ) {
226  $wgFooterIcons['poweredby']['mediawiki']['src'] =
227  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
228  $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
229  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
230  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
231 }
232 
241 
249 
254  'name' => 'fsLockManager',
255  'class' => FSLockManager::class,
256  'lockDirectory' => "{$wgUploadDirectory}/lockdir",
257 ];
258 $wgLockManagers[] = [
259  'name' => 'nullLockManager',
260  'class' => NullLockManager::class,
261 ];
262 
268  'imagesPerRow' => 0,
269  'imageWidth' => 120,
270  'imageHeight' => 120,
271  'captionLength' => true,
272  'showBytes' => true,
273  'showDimensions' => true,
274  'mode' => 'traditional',
275 ];
276 
280 if ( !$wgLocalFileRepo ) {
281  $wgLocalFileRepo = [
282  'class' => LocalRepo::class,
283  'name' => 'local',
284  'directory' => $wgUploadDirectory,
285  'scriptDirUrl' => $wgScriptPath,
287  'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
288  'thumbScriptUrl' => $wgThumbnailScriptPath,
289  'transformVia404' => !$wgGenerateThumbnailOnParse,
290  'deletedDir' => $wgDeletedDirectory,
291  'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
292  ];
293 }
294 
295 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
296  // Create a default FileBackend name.
297  // FileBackendGroup will register a default, if absent from $wgFileBackends.
298  $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
299 }
300 
304 if ( $wgUseSharedUploads ) {
305  if ( $wgSharedUploadDBname ) {
306  $wgForeignFileRepos[] = [
307  'class' => ForeignDBRepo::class,
308  'name' => 'shared',
309  'directory' => $wgSharedUploadDirectory,
310  'url' => $wgSharedUploadPath,
311  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
312  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
313  'transformVia404' => !$wgGenerateThumbnailOnParse,
314  'dbType' => $wgDBtype,
315  'dbServer' => $wgDBserver,
316  'dbUser' => $wgDBuser,
317  'dbPassword' => $wgDBpassword,
318  'dbName' => $wgSharedUploadDBname,
319  'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
320  'tablePrefix' => $wgSharedUploadDBprefix,
321  'hasSharedCache' => $wgCacheSharedUploads,
322  'descBaseUrl' => $wgRepositoryBaseUrl,
323  'fetchDescription' => $wgFetchCommonsDescriptions,
324  ];
325  } else {
326  $wgForeignFileRepos[] = [
327  'class' => FileRepo::class,
328  'name' => 'shared',
329  'directory' => $wgSharedUploadDirectory,
330  'url' => $wgSharedUploadPath,
331  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
332  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
333  'transformVia404' => !$wgGenerateThumbnailOnParse,
334  'descBaseUrl' => $wgRepositoryBaseUrl,
335  'fetchDescription' => $wgFetchCommonsDescriptions,
336  ];
337  }
338 }
339 if ( $wgUseInstantCommons ) {
340  $wgForeignFileRepos[] = [
341  'class' => ForeignAPIRepo::class,
342  'name' => 'wikimediacommons',
343  'apibase' => 'https://commons.wikimedia.org/w/api.php',
344  'url' => 'https://upload.wikimedia.org/wikipedia/commons',
345  'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
346  'hashLevels' => 2,
347  'transformVia404' => true,
348  'fetchDescription' => true,
349  'descriptionCacheExpiry' => 43200,
350  'apiThumbCacheExpiry' => 0,
351  ];
352 }
353 foreach ( $wgForeignFileRepos as &$repo ) {
354  if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) {
355  $repo['directory'] = $wgUploadDirectory; // b/c
356  }
357  if ( !isset( $repo['backend'] ) ) {
358  $repo['backend'] = $repo['name'] . '-backend';
359  }
360 }
361 unset( $repo ); // no global pollution; destroy reference
362 
363 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
364 if ( $wgRCFilterByAge ) {
365  // Trim down $wgRCLinkDays so that it only lists links which are valid
366  // as determined by $wgRCMaxAge.
367  // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
368  sort( $wgRCLinkDays );
369 
370  // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
371  for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
372  if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
373  $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
374  break;
375  }
376  }
377 }
378 // Ensure that default user options are not invalid, since that breaks Special:Preferences
379 $wgDefaultUserOptions['rcdays'] = min(
380  $wgDefaultUserOptions['rcdays'],
381  ceil( $rcMaxAgeDays )
382 );
383 $wgDefaultUserOptions['watchlistdays'] = min(
384  $wgDefaultUserOptions['watchlistdays'],
385  ceil( $rcMaxAgeDays )
386 );
387 unset( $rcMaxAgeDays );
388 
389 if ( $wgSkipSkin ) {
391 }
392 
393 $wgSkipSkins[] = 'fallback';
394 $wgSkipSkins[] = 'apioutput';
395 
396 if ( $wgLocalInterwiki ) {
397  array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
398 }
399 
400 // Set default shared prefix
401 if ( $wgSharedPrefix === false ) {
403 }
404 
405 // Set default shared schema
406 if ( $wgSharedSchema === false ) {
408 }
409 
410 if ( !$wgCookiePrefix ) {
411  if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
413  } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
415  } elseif ( $wgDBprefix ) {
417  } else {
419  }
420 }
421 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
422 
423 if ( $wgEnableEmail ) {
425 } else {
426  // Disable all other email settings automatically if $wgEnableEmail
427  // is set to false. - T65678
428  $wgAllowHTMLEmail = false;
429  $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
439  unset( $wgGroupPermissions['user']['sendemail'] );
440  $wgUseEnotif = false;
443 }
444 
445 if ( $wgMetaNamespace === false ) {
446  $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
447 }
448 
449 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
450 if ( $wgResourceLoaderMaxQueryLength === false ) {
451  $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
452  if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
453  $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
454  } else {
456  }
457  unset( $suhosinMaxValueLength );
458 }
459 
460 // Ensure the minimum chunk size is less than PHP upload limits or the maximum
461 // upload size.
464  UploadBase::getMaxUploadSize( 'file' ),
465  UploadBase::getMaxPhpUploadSize(),
467  ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
468  PHP_INT_MAX
469  ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
470 );
471 
477  NS_MEDIA => 'Media',
478  NS_SPECIAL => 'Special',
479  NS_TALK => 'Talk',
480  NS_USER => 'User',
481  NS_USER_TALK => 'User_talk',
482  NS_PROJECT => 'Project',
483  NS_PROJECT_TALK => 'Project_talk',
484  NS_FILE => 'File',
485  NS_FILE_TALK => 'File_talk',
486  NS_MEDIAWIKI => 'MediaWiki',
487  NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
488  NS_TEMPLATE => 'Template',
489  NS_TEMPLATE_TALK => 'Template_talk',
490  NS_HELP => 'Help',
491  NS_HELP_TALK => 'Help_talk',
492  NS_CATEGORY => 'Category',
493  NS_CATEGORY_TALK => 'Category_talk',
494 ];
495 
497 if ( is_array( $wgExtraNamespaces ) ) {
499 }
500 
501 // Hard-deprecate setting $wgDummyLanguageCodes in LocalSettings.php
502 if ( count( $wgDummyLanguageCodes ) !== 0 ) {
503  wfDeprecated( '$wgDummyLanguageCodes', '1.29' );
504 }
505 // Merge in the legacy language codes, incorporating overrides from the config
507  // Internal language codes of the private-use area which get mapped to
508  // themselves.
509  'qqq' => 'qqq', // Used for message documentation
510  'qqx' => 'qqx', // Used for viewing message keys
512 // Merge in (inverted) BCP 47 mappings
514  $bcp47 = strtolower( $bcp47 ); // force case-insensitivity
515  if ( !isset( $wgDummyLanguageCodes[$bcp47] ) ) {
517  }
518 }
519 
520 // These are now the same, always
521 // To determine the user language, use $wgLang->getCode()
523 
524 // Easy to forget to falsify $wgDebugToolbar for static caches.
525 // If file cache or CDN cache is on, just disable this (DWIMD).
526 if ( $wgUseFileCache || $wgUseSquid ) {
527  $wgDebugToolbar = false;
528 }
529 
530 // We always output HTML5 since 1.22, overriding these is no longer supported
531 // we set them here for extensions that depend on its value.
532 $wgHtml5 = true;
533 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
534 $wgJsMimeType = 'text/javascript';
535 
536 // Blacklisted file extensions shouldn't appear on the "allowed" list
537 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
538 
540  Wikimedia\suppressWarnings();
541  $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
542  Wikimedia\restoreWarnings();
543 }
544 
545 if ( $wgNewUserLog ) {
546  // Add new user log type
547  $wgLogTypes[] = 'newusers';
548  $wgLogNames['newusers'] = 'newuserlogpage';
549  $wgLogHeaders['newusers'] = 'newuserlogpagetext';
550  $wgLogActionsHandlers['newusers/newusers'] = NewUsersLogFormatter::class;
554  $wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class;
555 }
556 
557 if ( $wgPageCreationLog ) {
558  // Add page creation log type
559  $wgLogTypes[] = 'create';
560  $wgLogActionsHandlers['create/create'] = LogFormatter::class;
561 }
562 
563 if ( $wgPageLanguageUseDB ) {
564  $wgLogTypes[] = 'pagelang';
565  $wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class;
566 }
567 
568 if ( $wgCookieSecure === 'detect' ) {
569  $wgCookieSecure = ( WebRequest::detectProtocol() === 'https' );
570 }
571 
572 if ( $wgProfileOnly ) {
573  $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
574  $wgDebugLogFile = '';
575 }
576 
577 // Backwards compatibility with old password limits
578 if ( $wgMinimalPasswordLength !== false ) {
579  $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
580 }
581 
582 if ( $wgMaximalPasswordLength !== false ) {
583  $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
584 }
585 
586 // Backwards compatibility warning
587 if ( !$wgSessionsInObjectCache ) {
588  wfDeprecated( '$wgSessionsInObjectCache = false', '1.27' );
589  if ( $wgSessionHandler ) {
590  wfDeprecated( '$wgSessionsHandler', '1.27' );
591  }
592  $cacheType = get_class( ObjectCache::getInstance( $wgSessionCacheType ) );
593  wfDebugLog(
594  'caches',
595  "Session data will be stored in \"$cacheType\" cache with " .
596  "expiry $wgObjectCacheSessionExpiry seconds"
597  );
598 }
600 
601 if ( $wgPHPSessionHandling !== 'enable' &&
602  $wgPHPSessionHandling !== 'warn' &&
603  $wgPHPSessionHandling !== 'disable'
604 ) {
605  $wgPHPSessionHandling = 'warn';
606 }
607 if ( defined( 'MW_NO_SESSION' ) ) {
608  // If the entry point wants no session, force 'disable' here unless they
609  // specifically set it to the (undocumented) 'warn'.
610  $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
611 }
612 
613 Profiler::instance()->scopedProfileOut( $ps_default );
614 
615 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
616 // all the memory from logging SQL queries on maintenance scripts
619  MWDebug::init();
620 }
621 
622 // Reset the global service locator, so any services that have already been created will be
623 // re-created while taking into account any custom settings and extensions.
624 MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
625 
626 if ( $wgSharedDB && $wgSharedTables ) {
627  // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
628  MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
629  array_fill_keys(
631  [
632  'dbname' => $wgSharedDB,
633  'schema' => $wgSharedSchema,
634  'prefix' => $wgSharedPrefix
635  ]
636  )
637  );
638 }
639 
640 // Define a constant that indicates that the bootstrapping of the service locator
641 // is complete.
642 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
643 
645 
646 // T48998: Bail out early if $wgArticlePath is non-absolute
647 foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) {
648  if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
649  throw new FatalError(
650  "If you use a relative URL for \$$varName, it must start " .
651  'with a slash (<code>/</code>).<br><br>See ' .
652  "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
653  "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
654  );
655  }
656 }
657 
658 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
659 
660 if ( $wgCanonicalServer === false ) {
662 }
663 
664 // Set server name
666 if ( $wgServerName !== false ) {
667  wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
668  . 'not customized. Overwriting $wgServerName.' );
669 }
671 unset( $serverParts );
672 
673 // Set defaults for configuration variables
674 // that are derived from the server name by default
675 // Note: $wgEmergencyContact and $wgPasswordSender may be false or empty string (T104142)
676 if ( !$wgEmergencyContact ) {
677  $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
678 }
679 if ( !$wgPasswordSender ) {
680  $wgPasswordSender = 'apache@' . $wgServerName;
681 }
682 if ( !$wgNoReplyAddress ) {
684 }
685 
686 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
687  $wgSecureLogin = false;
688  wfWarn( 'Secure login was enabled on a server that only supports '
689  . 'HTTP or HTTPS. Disabling secure login.' );
690 }
691 
693 
694 // Now that GlobalFunctions is loaded, set defaults that depend on it.
695 if ( $wgTmpDirectory === false ) {
697 }
698 
699 // We don't use counters anymore. Left here for extensions still
700 // expecting this to exist. Should be removed sometime 1.26 or later.
701 if ( !isset( $wgDisableCounters ) ) {
702  $wgDisableCounters = true;
703 }
704 
705 if ( $wgMainWANCache === false ) {
706  // Setup a WAN cache from $wgMainCacheType with no relayer.
707  // Sites using multiple datacenters can configure a relayer.
708  $wgMainWANCache = 'mediawiki-main-default';
710  'class' => WANObjectCache::class,
711  'cacheId' => $wgMainCacheType,
712  'channels' => [ 'purge' => 'wancache-main-default-purge' ]
713  ];
714 }
715 
716 Profiler::instance()->scopedProfileOut( $ps_default2 );
717 
718 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' );
719 
720 // Raise the memory limit if it's too low
721 wfMemoryLimit();
722 
728 if ( is_null( $wgLocaltimezone ) ) {
729  Wikimedia\suppressWarnings();
730  $wgLocaltimezone = date_default_timezone_get();
731  Wikimedia\restoreWarnings();
732 }
733 
734 date_default_timezone_set( $wgLocaltimezone );
735 if ( is_null( $wgLocalTZoffset ) ) {
736  $wgLocalTZoffset = date( 'Z' ) / 60;
737 }
738 // The part after the System| is ignored, but rest of MW fills it
739 // out as the local offset.
740 $wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
741 
742 if ( !$wgDBerrorLogTZ ) {
744 }
745 
746 // Initialize the request object in $wgRequest
747 $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
748 // Set user IP/agent information for agent session consistency purposes
749 $cpPosInfo = LBFactory::getCPInfoFromCookieValue(
750  // The cookie has no prefix and is set by MediaWiki::preOutputCommit()
751  $wgRequest->getCookie( 'cpPosIndex', '' ),
752  // Mitigate broken client-side cookie expiration handling (T190082)
753  time() - ChronologyProtector::POSITION_COOKIE_TTL
754 );
755 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
756  'IPAddress' => $wgRequest->getIP(),
757  'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
758  'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ),
759  'ChronologyPositionIndex' => $wgRequest->getInt( 'cpPosIndex', $cpPosInfo['index'] ),
760  'ChronologyClientId' => $cpPosInfo['clientId']
761 ] );
762 unset( $cpPosInfo );
763 // Make sure that object caching does not undermine the ChronologyProtector improvements
764 if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) {
765  // The user is pinned to the primary DC, meaning that they made recent changes which should
766  // be reflected in their subsequent web requests. Avoid the use of interim cache keys because
767  // they use a blind TTL and could be stale if an object changes twice in a short time span.
768  MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching( false );
769 }
770 
771 // Useful debug output
772 if ( $wgCommandLineMode ) {
773  wfDebug( "\n\nStart command line script $self\n" );
774 } else {
775  $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
776 
777  if ( $wgDebugPrintHttpHeaders ) {
778  $debug .= "HTTP HEADERS:\n";
779 
780  foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
781  $debug .= "$name: $value\n";
782  }
783  }
784  wfDebug( $debug );
785 }
786 
789 
790 wfDebugLog( 'caches',
791  'cluster: ' . get_class( $wgMemc ) .
792  ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
793  ', stash: ' . $wgMainStash .
794  ', message: ' . get_class( $messageMemc ) .
795  ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
796 );
797 
798 Profiler::instance()->scopedProfileOut( $ps_misc );
799 
800 // Most of the config is out, some might want to run hooks here.
801 Hooks::run( 'SetupAfterCache' );
802 
803 $ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
804 
809 $wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
810 
811 // Now that variant lists may be available...
812 $wgRequest->interpolateTitle();
813 
814 if ( !is_object( $wgAuth ) ) {
816  Hooks::run( 'AuthPluginSetup', [ &$wgAuth ] );
817 }
818 if ( $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin ) {
819  MediaWiki\Auth\AuthManager::singleton()->forcePrimaryAuthenticationProviders( [
820  new MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider( [
821  'authoritative' => false,
822  ] ),
823  new MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider( $wgAuth ),
824  new MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider( [
825  'authoritative' => true,
826  ] ),
827  ], '$wgAuth is ' . get_class( $wgAuth ) );
828 }
829 
835 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
836  // If session.auto_start is there, we can't touch session name
837  if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
838  session_name( $wgSessionName ?: $wgCookiePrefix . '_session' );
839  }
840 
841  // Create the SessionManager singleton and set up our session handler,
842  // unless we're specifically asked not to.
843  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
845  MediaWiki\Session\SessionManager::singleton()
846  );
847  }
848 
849  // Initialize the session
850  try {
852  } catch ( OverflowException $ex ) {
853  if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
854  // The exception is because the request had multiple possible
855  // sessions tied for top priority. Report this to the user.
856  $list = [];
857  foreach ( $ex->sessionInfos as $info ) {
858  $list[] = $info->getProvider()->describe( $wgContLang );
859  }
860  $list = $wgContLang->listToText( $list );
861  throw new HttpError( 400,
862  Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )->plain()
863  );
864  }
865 
866  // Not the one we want, rethrow
867  throw $ex;
868  }
869 
870  if ( $session->isPersistent() ) {
871  $wgInitialSessionId = $session->getSessionId();
872  }
873 
874  $session->renew();
875  if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
876  ( $session->isPersistent() || $session->shouldRememberUser() )
877  ) {
878  // Start the PHP-session for backwards compatibility
879  session_id( $session->getId() );
880  Wikimedia\quietCall( 'session_start' );
881  }
882 
883  unset( $session );
884 } else {
885  // Even if we didn't set up a global Session, still install our session
886  // handler unless specifically requested not to.
887  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
889  MediaWiki\Session\SessionManager::singleton()
890  );
891  }
892 }
893 
897 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
898 
903 
907 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
908 
913 $wgParser = new StubObject( 'wgParser', function () {
914  return MediaWikiServices::getInstance()->getParser();
915 } );
916 
920 $wgTitle = null;
921 
922 Profiler::instance()->scopedProfileOut( $ps_globals );
923 $ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
924 
925 // Extension setup functions
926 // Entries should be added to this variable during the inclusion
927 // of the extension file. This allows the extension to perform
928 // any necessary initialisation in the fully initialised environment
929 foreach ( $wgExtensionFunctions as $func ) {
930  call_user_func( $func );
931 }
932 
933 // If the session user has a 0 id but a valid name, that means we need to
934 // autocreate it.
935 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
936  $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
937  if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
938  $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
939  $sessionUser,
940  MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
941  true
942  );
943  \MediaWiki\Logger\LoggerFactory::getInstance( 'authevents' )->info( 'Autocreation attempt', [
944  'event' => 'autocreate',
945  'status' => $res,
946  ] );
947  unset( $res );
948  }
949  unset( $sessionUser );
950 }
951 
952 if ( !$wgCommandLineMode ) {
954 }
955 
957 
958 Profiler::instance()->scopedProfileOut( $ps_extensions );
959 Profiler::instance()->scopedProfileOut( $ps_setup );
$wgCanonicalNamespaceNames
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
Definition: Setup.php:476
$wgSharedUploadDirectory
string $wgSharedUploadDirectory
Shortcut for the 'directory' setting of $wgForeignFileRepos.
Definition: DefaultSettings.php:590
$wgLocalInterwiki
$wgLocalInterwiki
The interwiki prefix of the current wiki, or false if it doesn't have one.
Definition: DefaultSettings.php:3937
LanguageCode\getDeprecatedCodeMapping
static getDeprecatedCodeMapping()
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up...
Definition: LanguageCode.php:128
MediaWiki\HeaderCallback\register
static register()
Register a callback to be called when headers are sent.
Definition: HeaderCallback.php:14
MediaWiki\Session\PHPSessionHandler\install
static install(SessionManager $manager)
Install a session handler for the current web request.
Definition: PHPSessionHandler.php:108
$wgUsersNotifiedOnAllChanges
$wgUsersNotifiedOnAllChanges
Definition: Setup.php:442
$wgMaximalPasswordLength
$wgMaximalPasswordLength
Specifies the maximal length of a user password (T64685).
Definition: DefaultSettings.php:4744
MW_NO_SESSION
const MW_NO_SESSION
Definition: load.php:30
$wgDBserver
$wgDBserver
Database host name or IP address.
Definition: DefaultSettings.php:1852
$wgFileBlacklist
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
Definition: DefaultSettings.php:938
$wgActionPaths
$wgActionPaths
Definition: img_auth.php:47
NS_HELP
const NS_HELP
Definition: Defines.php:76
$wgDBname
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
ObjectCache\getLocalClusterInstance
static getLocalClusterInstance()
Get the main cluster-local cache object.
Definition: ObjectCache.php:365
$wgRCLinkDays
$wgRCLinkDays
List of Days options to list in the Special:Recentchanges and Special:Recentchangeslinked pages.
Definition: DefaultSettings.php:6845
$wgResourceLoaderMaxQueryLength
$wgResourceLoaderMaxQueryLength
If set to a positive number, ResourceLoader will not generate URLs whose query string is more than th...
Definition: DefaultSettings.php:3780
$wgProfileOnly
$wgProfileOnly
Don't put non-profiling info into log file.
Definition: DefaultSettings.php:6437
$wgNamespaceProtection
if( $wgScript===false) if( $wgLoadScript===false) if( $wgArticlePath===false) if(!empty( $wgActionPaths) &&!isset( $wgActionPaths['view'])) if( $wgResourceBasePath===null) if( $wgStylePath===false) if( $wgLocalStylePath===false) if( $wgExtensionAssetsPath===false) if( $wgLogo===false) if( $wgUploadPath===false) if( $wgUploadDirectory===false) if( $wgReadOnlyFile===false) if( $wgFileCacheDirectory===false) if( $wgDeletedDirectory===false) if( $wgGitInfoCacheDirectory===false && $wgCacheDirectory !==false) if( $wgEnableParserCache===false) if( $wgRightsIcon) if(isset( $wgFooterIcons['copyright']['copyright']) && $wgFooterIcons['copyright']['copyright']===[]) if(isset( $wgFooterIcons['poweredby']) &&isset( $wgFooterIcons['poweredby']['mediawiki']) && $wgFooterIcons['poweredby']['mediawiki']['src']===null) $wgNamespaceProtection[NS_MEDIAWIKI]
Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgName...
Definition: Setup.php:240
$wgCookiePrefix
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:421
$wgMinUploadChunkSize
if( $wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Definition: Setup.php:462
$wgPageCreationLog
$wgPageCreationLog
Maintain a log of page creations at Special:Log/create?
Definition: DefaultSettings.php:7938
$wgParser
$wgParser
Definition: Setup.php:913
$wgEnotifFromEditor
$wgEnotifFromEditor
Definition: Setup.php:431
$wgInvalidateCacheOnLocalSettingsChange
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
Definition: DefaultSettings.php:2697
$wgGalleryOptions
$wgGalleryOptions
Default parameters for the "<gallery>" tag.
Definition: Setup.php:267
$wgTmpDirectory
$wgTmpDirectory
The local filesystem path to a temporary directory.
Definition: DefaultSettings.php:338
$wgRightsText
$wgRightsText
If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link.
Definition: DefaultSettings.php:7170
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:62
$wgEnotifWatchlist
$wgEnotifWatchlist
Definition: Setup.php:438
$wgSharedTables
$wgSharedTables
Definition: DefaultSettings.php:1996
$wgSharedSchema
$wgSharedSchema
Definition: DefaultSettings.php:2002
StubObject
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Definition: StubObject.php:45
$wgFileExtensions
$wgFileExtensions
Definition: Setup.php:537
NS_TEMPLATE_TALK
const NS_TEMPLATE_TALK
Definition: Defines.php:75
$wgLogHeaders
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type.
Definition: DefaultSettings.php:7794
captcha-old.count
count
Definition: captcha-old.py:249
$wgDefaultUserOptions
if( $wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
Definition: Setup.php:379
$wgUserEmailUseReplyTo
$wgUserEmailUseReplyTo
Definition: Setup.php:441
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:185
MediaWiki\Logger\LoggerFactory\getInstance
static getInstance( $channel)
Get a named logger instance from the currently configured logger factory.
Definition: LoggerFactory.php:92
CACHE_NONE
const CACHE_NONE
Definition: Defines.php:102
$ps_misc
$ps_misc
Definition: Setup.php:718
$wgDBtype
$wgDBtype
Database type.
Definition: DefaultSettings.php:1877
MediaWiki\Auth\AuthManagerAuthPlugin
Backwards-compatibility wrapper for AuthManager via $wgAuth.
Definition: AuthManagerAuthPlugin.php:31
$wgSharedDB
$wgSharedDB
Shared database for multiple wikis.
Definition: DefaultSettings.php:1986
$wgLocalFileRepo
$wgLocalFileRepo
File repository structures.
Definition: DefaultSettings.php:525
$wgWANObjectCaches
$wgWANObjectCaches
Advanced WAN object cache configuration.
Definition: DefaultSettings.php:2446
$wgSharedUploadDBname
bool string $wgSharedUploadDBname
Shortcut for the ForeignDBRepo 'dbName' setting in $wgForeignFileRepos.
Definition: DefaultSettings.php:635
$wgHtml5
if( $wgUseFileCache|| $wgUseSquid) $wgHtml5
Definition: Setup.php:532
DBO_DEBUG
const DBO_DEBUG
Definition: defines.php:9
$wgDBmwschema
$wgDBmwschema
Mediawiki schema.
Definition: DefaultSettings.php:1947
$wgVirtualRestConfig
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//') $wgVirtualRestConfig['global']['domain']
Definition: Setup.php:692
$wgGenerateThumbnailOnParse
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
Definition: DefaultSettings.php:1302
$wgEnableUserEmail
$wgEnableUserEmail
Definition: Setup.php:430
NS_FILE
const NS_FILE
Definition: Defines.php:70
$wgExtensionAssetsPath
$wgExtensionAssetsPath
The URL path of the extensions directory.
Definition: DefaultSettings.php:215
NS_TEMPLATE
const NS_TEMPLATE
Definition: Defines.php:74
MWExceptionHandler\installHandler
static installHandler()
Install handlers with PHP.
Definition: MWExceptionHandler.php:76
WebRequest\detectProtocol
static detectProtocol()
Detect the protocol from $_SERVER.
Definition: WebRequest.php:246
$wgUseSquid
$wgUseSquid
Enable/disable CDN.
Definition: DefaultSettings.php:2735
$res
$res
Definition: database.txt:21
$wgScopeTest
if(!defined( 'MEDIAWIKI')) $wgScopeTest
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:39
$wgCacheDirectory
$wgCacheDirectory
Directory for caching data in the local filesystem.
Definition: DefaultSettings.php:2317
User\isValidUserName
static isValidUserName( $name)
Is the input a valid username?
Definition: User.php:997
$wgSharedThumbnailScriptPath
string $wgSharedThumbnailScriptPath
Shortcut for the 'thumbScriptUrl' setting of $wgForeignFileRepos.
Definition: DefaultSettings.php:906
$wgLogo
$wgLogo
The URL path of the wiki logo.
Definition: DefaultSettings.php:261
$wgEnableParserCache
$wgEnableParserCache
Kept for extension compatibility; see $wgParserCacheType.
Definition: DefaultSettings.php:2648
wfDebugLog
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
Definition: GlobalFunctions.php:1082
$wgMetaNamespace
$wgMetaNamespace
Name of the project namespace.
Definition: DefaultSettings.php:3839
HttpError
Show an error that looks like an HTTP server error.
Definition: HttpError.php:30
$wgDBpassword
$wgDBpassword
Database user's password.
Definition: DefaultSettings.php:1872
$wgDBprefix
$wgDBprefix
Table name prefix.
Definition: DefaultSettings.php:1929
$wgFetchCommonsDescriptions
bool $wgFetchCommonsDescriptions
Shortcut for the 'fetchDescription' setting of $wgForeignFileRepos.
Definition: DefaultSettings.php:625
$wgStylePath
$wgStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:200
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$wgMemc
$wgMemc
Definition: Setup.php:787
$ps_default2
foreach([ 'wgArticlePath', 'wgVariantArticlePath'] as $varName) $ps_default2
Definition: Setup.php:658
$debug
$debug
Definition: mcc.php:31
$wgRepositoryBaseUrl
$wgRepositoryBaseUrl
Shortcut for the 'descBaseUrl' setting of $wgForeignFileRepos.
Definition: DefaultSettings.php:616
$rcMaxAgeDays
$rcMaxAgeDays
Definition: Setup.php:363
$wgUseInstantCommons
$wgUseInstantCommons
Use Wikimedia Commons as a foreign file repository.
Definition: DefaultSettings.php:551
ExtensionRegistry\getInstance
static getInstance()
Definition: ExtensionRegistry.php:88
$wgHashedUploadDirectory
$wgHashedUploadDirectory
Set this to false if you do not want MediaWiki to divide your images directory into many subdirectori...
Definition: DefaultSettings.php:921
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:53
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:814
$wgHashedSharedUploadDirectory
bool $wgHashedSharedUploadDirectory
Shortcut for the 'hashLevels' setting of $wgForeignFileRepos.
Definition: DefaultSettings.php:608
$wgNoReplyAddress
$wgNoReplyAddress
Reply-To address for e-mail notifications.
Definition: DefaultSettings.php:1654
$wgEnotifMaxRecips
$wgEnotifMaxRecips
Definition: Setup.php:433
NS_PROJECT
const NS_PROJECT
Definition: Defines.php:68
$wgEmergencyContact
$wgEmergencyContact
Site admin email address.
Definition: DefaultSettings.php:1637
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1118
$wgFooterIcons
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
Definition: DefaultSettings.php:3494
$ps_default
$ps_default
Definition: Setup.php:136
$wgUseFileCache
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
Definition: DefaultSettings.php:2634
$wgCommandLineMode
global $wgCommandLineMode
Definition: Setup.php:617
NS_MEDIAWIKI_TALK
const NS_MEDIAWIKI_TALK
Definition: Defines.php:73
$wgDebugLogGroups
$wgDebugLogGroups
Map of string log group names to log destinations.
Definition: DefaultSettings.php:6244
$wgLang
$wgLang
Definition: Setup.php:902
$wgDummyLanguageCodes
if(is_array( $wgExtraNamespaces)) if(count( $wgDummyLanguageCodes) !==0) $wgDummyLanguageCodes
Definition: Setup.php:506
MW_CONFIG_CALLBACK
const MW_CONFIG_CALLBACK
Definition: install.php:26
$wgEnotifUserTalk
$wgEnotifUserTalk
Definition: Setup.php:437
$wgLoadScript
$wgLoadScript
The URL path to load.php.
Definition: DefaultSettings.php:193
MediaWiki
A helper class for throttling authentication attempts.
$wgSharedPrefix
$wgSharedPrefix
Definition: DefaultSettings.php:1991
ObjectCache\getInstance
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:92
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
$code
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub 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:813
$wgLogTypes
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
Definition: DefaultSettings.php:7710
$wgParserCacheType
$wgParserCacheType
The cache type for storing article HTML.
Definition: DefaultSettings.php:2352
$wgEnotifUseRealName
$wgEnotifUseRealName
Definition: Setup.php:436
$wgEnableEmail
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
Definition: DefaultSettings.php:1661
GlobalVarConfig
Accesses configuration settings from $GLOBALS.
Definition: GlobalVarConfig.php:28
$wgSessionName
$wgSessionName
Override to customise the session name.
Definition: DefaultSettings.php:6064
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:78
wfMemoryLimit
wfMemoryLimit()
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
Definition: GlobalFunctions.php:2924
$wgDebugLogFile
$wgDebugLogFile
Filename for debug logging.
Definition: DefaultSettings.php:6114
wfDebug
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
Definition: GlobalFunctions.php:988
$wgCanonicalServer
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
Definition: DefaultSettings.php:114
$wgSkipSkin
$wgSkipSkin
Definition: DefaultSettings.php:3346
$wgEnotifRevealEditorAddress
$wgEnotifRevealEditorAddress
Definition: Setup.php:435
$wgLockManagers
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
Definition: Setup.php:253
$wgUseSharedUploads
bool $wgUseSharedUploads
Shortcut for adding an entry to $wgForeignFileRepos.
Definition: DefaultSettings.php:581
$wgFullyInitialised
foreach( $wgExtensionFunctions as $func) if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised
Definition: Setup.php:956
$fname
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition: Setup.php:121
$wgPageLanguageUseDB
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
Definition: DefaultSettings.php:8712
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
$wgEnotifMinorEdits
$wgEnotifMinorEdits
Definition: Setup.php:434
MediaWiki\Session\SessionManager\getGlobalSession
static getGlobalSession()
Get the "global" session.
Definition: SessionManager.php:107
$wgSessionsInObjectCache
if( $wgInvalidateCacheOnLocalSettingsChange) if( $wgNewUserLog) if( $wgPageCreationLog) if( $wgPageLanguageUseDB) if( $wgCookieSecure==='detect') if( $wgProfileOnly) if( $wgMinimalPasswordLength !==false) if( $wgMaximalPasswordLength !==false) if(! $wgSessionsInObjectCache) $wgSessionsInObjectCache
Definition: Setup.php:599
$wgTitle
$wgTitle
Definition: Setup.php:920
$wgSessionHandler
$wgSessionHandler
Definition: DefaultSettings.php:2509
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:67
$wgDebugPrintHttpHeaders
$wgDebugPrintHttpHeaders
Print HTTP headers for every request in the debug information.
Definition: DefaultSettings.php:6287
$messageMemc
$messageMemc
Definition: Setup.php:788
$value
$value
Definition: styleTest.css.php:49
$wgLocalTZoffset
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
Definition: DefaultSettings.php:3221
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:52
$wgNamespaceAliases
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
Definition: Setup.php:247
$wgLocalInterwikis
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
Definition: DefaultSettings.php:3947
$wgDeletedDirectory
$wgDeletedDirectory
What directory to place deleted uploads in.
Definition: DefaultSettings.php:423
$wgCacheSharedUploads
bool $wgCacheSharedUploads
Shortcut for the ForeignDBRepo 'hasSharedCache' setting in $wgForeignFileRepos.
Definition: DefaultSettings.php:653
StubUserLang
Stub object for the user language.
Definition: StubObject.php:178
$wgServer
$wgServer
URL of the server.
Definition: DefaultSettings.php:105
$wgRCMaxAge
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go.
Definition: DefaultSettings.php:6809
$wgLanguageCode
$wgLanguageCode
Site language code.
Definition: DefaultSettings.php:2942
$wgSitename
$wgSitename
Name of the site.
Definition: DefaultSettings.php:79
$wgRightsIcon
$wgRightsIcon
Override for copyright metadata.
Definition: DefaultSettings.php:7175
PROTO_HTTP
const PROTO_HTTP
Definition: Defines.php:219
$wgJsMimeType
$wgJsMimeType
Definition: Setup.php:534
NS_PROJECT_TALK
const NS_PROJECT_TALK
Definition: Defines.php:69
MWDebug\init
static init()
Enabled the debugger and load resource module.
Definition: MWDebug.php:76
$wgExtensionFunctions
$wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
Definition: DefaultSettings.php:7298
$wgEmailAuthentication
$wgEmailAuthentication
Definition: Setup.php:429
$wgUploadBaseUrl
$wgUploadBaseUrl
If set, this URL is added to the start of $wgUploadPath to form a complete upload URL.
Definition: DefaultSettings.php:345
$wgUploadDirectory
$wgUploadDirectory
The filesystem path of the images directory.
Definition: DefaultSettings.php:249
$wgAllowHTMLEmail
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
Definition: DefaultSettings.php:1743
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:432
$wgLogActionsHandlers
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
Definition: DefaultSettings.php:7822
wfIniGetBool
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
Definition: GlobalFunctions.php:2146
plain
either a plain
Definition: hooks.txt:2097
$wgResourceBasePath
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
Definition: DefaultSettings.php:3697
$serverParts
if( $wgCanonicalServer===false) $serverParts
Definition: Setup.php:665
$wgUseEnotif
$wgUseEnotif
Definition: Setup.php:440
$wgSessionCacheType
$wgSessionCacheType
The cache type for storing session data.
Definition: DefaultSettings.php:2359
$wgArticlePath
$wgArticlePath
Definition: img_auth.php:46
$ps_setup
$ps_setup
Definition: Setup.php:122
wfGetMessageCacheStorage
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
Definition: GlobalFunctions.php:3038
$wgCacheEpoch
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
Definition: DefaultSettings.php:2621
wfShorthandToInteger
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:2973
$wgGitInfoCacheDirectory
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
Definition: DefaultSettings.php:2627
$wgXhtmlDefaultNamespace
$wgXhtmlDefaultNamespace
Definition: Setup.php:533
wfTempDir
wfTempDir()
Tries to get the system directory for temporary files.
Definition: GlobalFunctions.php:2031
$wgMainCacheType
CACHE_MEMCACHED $wgMainCacheType
Definition: memcached.txt:63
$wgReadOnlyFile
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode.
Definition: DefaultSettings.php:6759
$wgSkipSkins
if( $wgSkipSkin) $wgSkipSkins[]
Definition: Setup.php:393
NS_HELP_TALK
const NS_HELP_TALK
Definition: Defines.php:77
MediaWiki\Auth\AuthManager\singleton
static singleton()
Get the global AuthManager.
Definition: AuthManager.php:147
$wgThumbnailScriptPath
$wgThumbnailScriptPath
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating t...
Definition: DefaultSettings.php:897
$wgContLanguageCode
foreach(LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode
Definition: Setup.php:522
Wikimedia\Rdbms\ChronologyProtector
Class for ensuring a consistent ordering of events as seen by the user, despite replication.
Definition: ChronologyProtector.php:36
FatalError
Exception class which takes an HTML error message, and does not produce a backtrace.
Definition: FatalError.php:28
$wgLocaltimezone
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
Definition: DefaultSettings.php:3210
$wgEnotifImpersonal
$wgEnotifImpersonal
Definition: Setup.php:432
Wikimedia\Rdbms\LBFactory
An interface for generating database load balancers.
Definition: LBFactory.php:39
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
$wgSharedUploadDBprefix
string $wgSharedUploadDBprefix
Shortcut for the ForeignDBRepo 'tablePrefix' setting in $wgForeignFileRepos.
Definition: DefaultSettings.php:644
$wgCookieSecure
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
Definition: DefaultSettings.php:6032
$ps_globals
$ps_globals
Definition: Setup.php:803
$wgShellLocale
$wgShellLocale
Locale for LC_ALL, to provide a known environment for locale-sensitive operations.
Definition: DefaultSettings.php:8380
$cpPosInfo
$cpPosInfo
Definition: Setup.php:749
NS_USER
const NS_USER
Definition: Defines.php:66
$ps_extensions
$ps_extensions
Definition: Setup.php:923
NS_TALK
const NS_TALK
Definition: Defines.php:65
$wgLogNames
$wgLogNames
Lists the message key string for each log type.
Definition: DefaultSettings.php:7771
$wgFileCacheDirectory
$wgFileCacheDirectory
Directory where the cached page will be saved.
Definition: DefaultSettings.php:255
$wgUploadPath
$wgUploadPath
The URL path for the images directory.
Definition: DefaultSettings.php:244
wfWarn
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Definition: GlobalFunctions.php:1132
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:72
$wgGroupPermissions
$wgGroupPermissions['sysop']['replacetext']
Definition: ReplaceText.php:56
class
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
$wgDBuser
$wgDBuser
Database username.
Definition: DefaultSettings.php:1867
$wgAuth
$wgAuth $wgAuth
Authentication plugin.
Definition: DefaultSettings.php:7472
$wgDBerrorLogTZ
$wgDBerrorLogTZ
Timezone to use in the error log.
Definition: DefaultSettings.php:2104
$wgPasswordPolicy
$wgPasswordPolicy
Password policy for local wiki users.
Definition: DefaultSettings.php:4506
$wgDebugDumpSql
$wgDebugDumpSql
Write SQL queries to the debug log.
Definition: DefaultSettings.php:6153
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:747
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
Pingback\schedulePingback
static schedulePingback()
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send...
Definition: Pingback.php:271
$wgMinimalPasswordLength
$wgMinimalPasswordLength
Specifies the minimal length of a user password.
Definition: DefaultSettings.php:4731
$wgRCFilterByAge
$wgRCFilterByAge
Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be store...
Definition: DefaultSettings.php:6833
$wgServerName
if( $wgServerName !==false) $wgServerName
Definition: Setup.php:670
$wgDebugToolbar
$wgDebugToolbar
Display the new debugging toolbar.
Definition: DefaultSettings.php:6518
NS_FILE_TALK
const NS_FILE_TALK
Definition: Defines.php:71
$wgOut
$wgOut
Definition: Setup.php:907
NS_CATEGORY_TALK
const NS_CATEGORY_TALK
Definition: Defines.php:79
$wgPasswordSender
$wgPasswordSender
Sender email address for e-mail notifications.
Definition: DefaultSettings.php:1647
$wgPHPSessionHandling
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
Definition: DefaultSettings.php:2527
$wgExtraLanguageCodes
$wgExtraLanguageCodes
List of mappings from one language code to another.
Definition: DefaultSettings.php:3004
$wgScriptPath
$wgScriptPath
The path we should point to.
Definition: DefaultSettings.php:137
DBO_DEFAULT
const DBO_DEFAULT
Definition: defines.php:13
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
LanguageCode\getNonstandardLanguageCodeMapping
static getNonstandardLanguageCodeMapping()
Returns a mapping of non-standard language codes used by (current and previous version of) MediaWiki,...
Definition: LanguageCode.php:144
$wgContLang
$wgContLang
Definition: Setup.php:809
$wgForeignFileRepos
$wgForeignFileRepos
Enable the use of files from one or more other wikis.
Definition: DefaultSettings.php:540
$wgLocalStylePath
$wgLocalStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:208
$wgSecureLogin
$wgSecureLogin
This is to let user authenticate using https when they come from http.
Definition: DefaultSettings.php:4952
$wgMainStash
$wgMainStash
Main object stash type.
Definition: DefaultSettings.php:2488
$wgExtraNamespaces
$wgExtraNamespaces
Additional namespaces.
Definition: DefaultSettings.php:3876
$wgInitialSessionId
$wgInitialSessionId
Definition: Setup.php:834
$wgNewUserLog
$wgNewUserLog
Maintain a log of newusers at Special:Log/newusers?
Definition: DefaultSettings.php:7932
$wgMainWANCache
$wgMainWANCache
Main Wide-Area-Network cache type.
Definition: DefaultSettings.php:2429
$GLOBALS
$GLOBALS['IP']
Definition: ComposerHookHandler.php:6
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:512
$wgRightsUrl
$wgRightsUrl
Set this to specify an external URL containing details about the content license used on your wiki.
Definition: DefaultSettings.php:7162
$wgUsePathInfo
$wgUsePathInfo
Whether to support URLs like index.php/Page_title These often break when PHP is set up in CGI mode.
Definition: DefaultSettings.php:156
$wgSharedUploadPath
string $wgSharedUploadPath
Shortcut for the 'url' setting of $wgForeignFileRepos.
Definition: DefaultSettings.php:599