MediaWiki  REL1_31
Setup.php
Go to the documentation of this file.
1 <?php
27 
32 if ( !defined( 'MEDIAWIKI' ) ) {
33  exit( 1 );
34 }
35 
40 // Get profiler configuraton
42 if ( file_exists( "$IP/StartProfiler.php" ) ) {
43  require "$IP/StartProfiler.php";
44 }
45 
46 // Start the autoloader, so that extensions can derive classes from core files
47 require_once "$IP/includes/AutoLoader.php";
48 
49 // Load up some global defines
50 require_once "$IP/includes/Defines.php";
51 
52 // Load default settings
53 require_once "$IP/includes/DefaultSettings.php";
54 
55 // Load global functions
56 require_once "$IP/includes/GlobalFunctions.php";
57 
58 // Load composer's autoloader if present
59 if ( is_readable( "$IP/vendor/autoload.php" ) ) {
60  require_once "$IP/vendor/autoload.php";
61 }
62 
63 // Assert that composer dependencies were successfully loaded
64 // Purposely no leading \ due to it breaking HHVM RepoAuthorative mode
65 // PHP works fine with both versions
66 // See https://github.com/facebook/hhvm/issues/5833
67 if ( !interface_exists( 'Psr\Log\LoggerInterface' ) ) {
68  $message = (
69  'MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging ' .
70  "library</a> to be present. This library is not embedded directly in MediaWiki's " .
71  "git repository and must be installed separately by the end user.\n\n" .
72  'Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git' .
73  '#Fetch_external_libraries">mediawiki.org</a> for help on installing ' .
74  'the required components.'
75  );
76  echo $message;
77  trigger_error( $message, E_USER_ERROR );
78  die( 1 );
79 }
80 
81 // Install a header callback
83 
88 if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
89  call_user_func( MW_CONFIG_CALLBACK );
90 } else {
91  if ( !defined( 'MW_CONFIG_FILE' ) ) {
92  define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
93  }
94  require_once MW_CONFIG_FILE;
95 }
96 
104 if ( defined( 'MW_SETUP_CALLBACK' ) ) {
105  call_user_func( MW_SETUP_CALLBACK );
106 }
107 
112 $fname = 'Setup.php';
113 $ps_setup = Profiler::instance()->scopedProfileIn( $fname );
114 
115 // Load queued extensions
116 ExtensionRegistry::getInstance()->loadFromQueue();
117 // Don't let any other extensions load
119 
120 // Check to see if we are at the file scope
121 if ( !isset( $wgVersion ) ) {
122  echo "Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
123  die( 1 );
124 }
125 
126 mb_internal_encoding( 'UTF-8' );
127 
128 // Set the configured locale on all requests for consisteny
129 putenv( "LC_ALL=$wgShellLocale" );
130 setlocale( LC_ALL, $wgShellLocale );
131 
132 // Set various default paths sensibly...
133 $ps_default = Profiler::instance()->scopedProfileIn( $fname . '-defaults' );
134 
135 if ( $wgScript === false ) {
136  $wgScript = "$wgScriptPath/index.php";
137 }
138 if ( $wgLoadScript === false ) {
139  $wgLoadScript = "$wgScriptPath/load.php";
140 }
141 
142 if ( $wgArticlePath === false ) {
143  if ( $wgUsePathInfo ) {
144  $wgArticlePath = "$wgScript/$1";
145  } else {
146  $wgArticlePath = "$wgScript?title=$1";
147  }
148 }
149 
150 if ( !empty( $wgActionPaths ) && !isset( $wgActionPaths['view'] ) ) {
151  // 'view' is assumed the default action path everywhere in the code
152  // but is rarely filled in $wgActionPaths
153  $wgActionPaths['view'] = $wgArticlePath;
154 }
155 
156 if ( $wgResourceBasePath === null ) {
158 }
159 if ( $wgStylePath === false ) {
160  $wgStylePath = "$wgResourceBasePath/skins";
161 }
162 if ( $wgLocalStylePath === false ) {
163  // Avoid wgResourceBasePath here since that may point to a different domain (e.g. CDN)
164  $wgLocalStylePath = "$wgScriptPath/skins";
165 }
166 if ( $wgExtensionAssetsPath === false ) {
167  $wgExtensionAssetsPath = "$wgResourceBasePath/extensions";
168 }
169 
170 if ( $wgLogo === false ) {
171  $wgLogo = "$wgResourceBasePath/resources/assets/wiki.png";
172 }
173 
174 if ( $wgUploadPath === false ) {
175  $wgUploadPath = "$wgScriptPath/images";
176 }
177 if ( $wgUploadDirectory === false ) {
178  $wgUploadDirectory = "$IP/images";
179 }
180 if ( $wgReadOnlyFile === false ) {
181  $wgReadOnlyFile = "{$wgUploadDirectory}/lock_yBgMBwiR";
182 }
183 if ( $wgFileCacheDirectory === false ) {
184  $wgFileCacheDirectory = "{$wgUploadDirectory}/cache";
185 }
186 if ( $wgDeletedDirectory === false ) {
187  $wgDeletedDirectory = "{$wgUploadDirectory}/deleted";
188 }
189 
190 if ( $wgGitInfoCacheDirectory === false && $wgCacheDirectory !== false ) {
191  $wgGitInfoCacheDirectory = "{$wgCacheDirectory}/gitinfo";
192 }
193 
194 if ( $wgEnableParserCache === false ) {
196 }
197 
198 // Fix path to icon images after they were moved in 1.24
199 if ( $wgRightsIcon ) {
200  $wgRightsIcon = str_replace(
201  "{$wgStylePath}/common/images/",
202  "{$wgResourceBasePath}/resources/assets/licenses/",
204  );
205 }
206 
207 if ( isset( $wgFooterIcons['copyright']['copyright'] )
208  && $wgFooterIcons['copyright']['copyright'] === []
209 ) {
210  if ( $wgRightsIcon || $wgRightsText ) {
211  $wgFooterIcons['copyright']['copyright'] = [
212  'url' => $wgRightsUrl,
213  'src' => $wgRightsIcon,
214  'alt' => $wgRightsText,
215  ];
216  }
217 }
218 
219 if ( isset( $wgFooterIcons['poweredby'] )
220  && isset( $wgFooterIcons['poweredby']['mediawiki'] )
221  && $wgFooterIcons['poweredby']['mediawiki']['src'] === null
222 ) {
223  $wgFooterIcons['poweredby']['mediawiki']['src'] =
224  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
225  $wgFooterIcons['poweredby']['mediawiki']['srcset'] =
226  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
227  "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
228 }
229 
238 
246 
251  'name' => 'fsLockManager',
252  'class' => FSLockManager::class,
253  'lockDirectory' => "{$wgUploadDirectory}/lockdir",
254 ];
255 $wgLockManagers[] = [
256  'name' => 'nullLockManager',
257  'class' => NullLockManager::class,
258 ];
259 
265  'imagesPerRow' => 0,
266  'imageWidth' => 120,
267  'imageHeight' => 120,
268  'captionLength' => true,
269  'showBytes' => true,
270  'showDimensions' => true,
271  'mode' => 'traditional',
272 ];
273 
277 if ( !$wgLocalFileRepo ) {
278  $wgLocalFileRepo = [
279  'class' => LocalRepo::class,
280  'name' => 'local',
281  'directory' => $wgUploadDirectory,
282  'scriptDirUrl' => $wgScriptPath,
284  'hashLevels' => $wgHashedUploadDirectory ? 2 : 0,
285  'thumbScriptUrl' => $wgThumbnailScriptPath,
286  'transformVia404' => !$wgGenerateThumbnailOnParse,
287  'deletedDir' => $wgDeletedDirectory,
288  'deletedHashLevels' => $wgHashedUploadDirectory ? 3 : 0
289  ];
290 }
294 if ( $wgUseSharedUploads ) {
295  if ( $wgSharedUploadDBname ) {
296  $wgForeignFileRepos[] = [
297  'class' => ForeignDBRepo::class,
298  'name' => 'shared',
299  'directory' => $wgSharedUploadDirectory,
300  'url' => $wgSharedUploadPath,
301  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
302  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
303  'transformVia404' => !$wgGenerateThumbnailOnParse,
304  'dbType' => $wgDBtype,
305  'dbServer' => $wgDBserver,
306  'dbUser' => $wgDBuser,
307  'dbPassword' => $wgDBpassword,
308  'dbName' => $wgSharedUploadDBname,
309  'dbFlags' => ( $wgDebugDumpSql ? DBO_DEBUG : 0 ) | DBO_DEFAULT,
310  'tablePrefix' => $wgSharedUploadDBprefix,
311  'hasSharedCache' => $wgCacheSharedUploads,
312  'descBaseUrl' => $wgRepositoryBaseUrl,
313  'fetchDescription' => $wgFetchCommonsDescriptions,
314  ];
315  } else {
316  $wgForeignFileRepos[] = [
317  'class' => FileRepo::class,
318  'name' => 'shared',
319  'directory' => $wgSharedUploadDirectory,
320  'url' => $wgSharedUploadPath,
321  'hashLevels' => $wgHashedSharedUploadDirectory ? 2 : 0,
322  'thumbScriptUrl' => $wgSharedThumbnailScriptPath,
323  'transformVia404' => !$wgGenerateThumbnailOnParse,
324  'descBaseUrl' => $wgRepositoryBaseUrl,
325  'fetchDescription' => $wgFetchCommonsDescriptions,
326  ];
327  }
328 }
329 if ( $wgUseInstantCommons ) {
330  $wgForeignFileRepos[] = [
331  'class' => ForeignAPIRepo::class,
332  'name' => 'wikimediacommons',
333  'apibase' => 'https://commons.wikimedia.org/w/api.php',
334  'url' => 'https://upload.wikimedia.org/wikipedia/commons',
335  'thumbUrl' => 'https://upload.wikimedia.org/wikipedia/commons/thumb',
336  'hashLevels' => 2,
337  'transformVia404' => true,
338  'fetchDescription' => true,
339  'descriptionCacheExpiry' => 43200,
340  'apiThumbCacheExpiry' => 0,
341  ];
342 }
343 /*
344  * Add on default file backend config for file repos.
345  * FileBackendGroup will handle initializing the backends.
346  */
347 if ( !isset( $wgLocalFileRepo['backend'] ) ) {
348  $wgLocalFileRepo['backend'] = $wgLocalFileRepo['name'] . '-backend';
349 }
350 foreach ( $wgForeignFileRepos as &$repo ) {
351  if ( !isset( $repo['directory'] ) && $repo['class'] === ForeignAPIRepo::class ) {
352  $repo['directory'] = $wgUploadDirectory; // b/c
353  }
354  if ( !isset( $repo['backend'] ) ) {
355  $repo['backend'] = $repo['name'] . '-backend';
356  }
357 }
358 unset( $repo ); // no global pollution; destroy reference
359 
360 // Convert this deprecated setting to modern system
361 if ( $wgExperimentalHtmlIds ) {
362  wfDeprecated( '$wgExperimentalHtmlIds', '1.30' );
363  $wgFragmentMode = [ 'html5-legacy', 'html5' ];
364 }
365 
366 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 );
367 if ( $wgRCFilterByAge ) {
368  // Trim down $wgRCLinkDays so that it only lists links which are valid
369  // as determined by $wgRCMaxAge.
370  // Note that we allow 1 link higher than the max for things like 56 days but a 60 day link.
371  sort( $wgRCLinkDays );
372 
373  // phpcs:ignore Generic.CodeAnalysis.ForLoopWithTestFunctionCall
374  for ( $i = 0; $i < count( $wgRCLinkDays ); $i++ ) {
375  if ( $wgRCLinkDays[$i] >= $rcMaxAgeDays ) {
376  $wgRCLinkDays = array_slice( $wgRCLinkDays, 0, $i + 1, false );
377  break;
378  }
379  }
380 }
381 // Ensure that default user options are not invalid, since that breaks Special:Preferences
382 $wgDefaultUserOptions['rcdays'] = min(
383  $wgDefaultUserOptions['rcdays'],
384  ceil( $rcMaxAgeDays )
385 );
386 $wgDefaultUserOptions['watchlistdays'] = min(
387  $wgDefaultUserOptions['watchlistdays'],
388  ceil( $rcMaxAgeDays )
389 );
390 unset( $rcMaxAgeDays );
391 
392 if ( $wgSkipSkin ) {
394 }
395 
396 $wgSkipSkins[] = 'fallback';
397 $wgSkipSkins[] = 'apioutput';
398 
399 if ( $wgLocalInterwiki ) {
400  array_unshift( $wgLocalInterwikis, $wgLocalInterwiki );
401 }
402 
403 // Set default shared prefix
404 if ( $wgSharedPrefix === false ) {
406 }
407 
408 // Set default shared schema
409 if ( $wgSharedSchema === false ) {
411 }
412 
413 if ( !$wgCookiePrefix ) {
414  if ( $wgSharedDB && $wgSharedPrefix && in_array( 'user', $wgSharedTables ) ) {
416  } elseif ( $wgSharedDB && in_array( 'user', $wgSharedTables ) ) {
418  } elseif ( $wgDBprefix ) {
420  } else {
422  }
423 }
424 $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' );
425 
426 if ( $wgEnableEmail ) {
428 } else {
429  // Disable all other email settings automatically if $wgEnableEmail
430  // is set to false. - T65678
431  $wgAllowHTMLEmail = false;
432  $wgEmailAuthentication = false; // do not require auth if you're not sending email anyway
442  unset( $wgGroupPermissions['user']['sendemail'] );
443  $wgUseEnotif = false;
446 }
447 
448 if ( $wgMetaNamespace === false ) {
449  $wgMetaNamespace = str_replace( ' ', '_', $wgSitename );
450 }
451 
452 // Default value is 2000 or the suhosin limit if it is between 1 and 2000
453 if ( $wgResourceLoaderMaxQueryLength === false ) {
454  $suhosinMaxValueLength = (int)ini_get( 'suhosin.get.max_value_length' );
455  if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
456  $wgResourceLoaderMaxQueryLength = $suhosinMaxValueLength;
457  } else {
459  }
460  unset( $suhosinMaxValueLength );
461 }
462 
463 // Ensure the minimum chunk size is less than PHP upload limits or the maximum
464 // upload size.
470  ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
471  PHP_INT_MAX
472  ) ?: PHP_INT_MAX ) - 1024 // Leave some room for other POST parameters
473 );
474 
480  NS_MEDIA => 'Media',
481  NS_SPECIAL => 'Special',
482  NS_TALK => 'Talk',
483  NS_USER => 'User',
484  NS_USER_TALK => 'User_talk',
485  NS_PROJECT => 'Project',
486  NS_PROJECT_TALK => 'Project_talk',
487  NS_FILE => 'File',
488  NS_FILE_TALK => 'File_talk',
489  NS_MEDIAWIKI => 'MediaWiki',
490  NS_MEDIAWIKI_TALK => 'MediaWiki_talk',
491  NS_TEMPLATE => 'Template',
492  NS_TEMPLATE_TALK => 'Template_talk',
493  NS_HELP => 'Help',
494  NS_HELP_TALK => 'Help_talk',
495  NS_CATEGORY => 'Category',
496  NS_CATEGORY_TALK => 'Category_talk',
497 ];
498 
500 if ( is_array( $wgExtraNamespaces ) ) {
502 }
503 
504 // Merge in the legacy language codes, incorporating overrides from the config
506  'qqq' => 'qqq', // Used for message documentation
507  'qqx' => 'qqx', // Used for viewing message keys
509 
510 // These are now the same, always
511 // To determine the user language, use $wgLang->getCode()
513 
514 // Easy to forget to falsify $wgDebugToolbar for static caches.
515 // If file cache or CDN cache is on, just disable this (DWIMD).
516 if ( $wgUseFileCache || $wgUseSquid ) {
517  $wgDebugToolbar = false;
518 }
519 
520 // We always output HTML5 since 1.22, overriding these is no longer supported
521 // we set them here for extensions that depend on its value.
522 $wgHtml5 = true;
523 $wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
524 $wgJsMimeType = 'text/javascript';
525 
526 // Blacklisted file extensions shouldn't appear on the "allowed" list
527 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) );
528 
530  Wikimedia\suppressWarnings();
531  $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
532  Wikimedia\restoreWarnings();
533 }
534 
535 if ( $wgNewUserLog ) {
536  // Add a new log type
537  $wgLogTypes[] = 'newusers';
538  $wgLogNames['newusers'] = 'newuserlogpage';
539  $wgLogHeaders['newusers'] = 'newuserlogpagetext';
540  $wgLogActionsHandlers['newusers/newusers'] = NewUsersLogFormatter::class;
544  $wgLogActionsHandlers['newusers/autocreate'] = NewUsersLogFormatter::class;
545 }
546 
547 if ( $wgPageLanguageUseDB ) {
548  $wgLogTypes[] = 'pagelang';
549  $wgLogActionsHandlers['pagelang/pagelang'] = PageLangLogFormatter::class;
550 }
551 
552 if ( $wgCookieSecure === 'detect' ) {
554 }
555 
556 if ( $wgProfileOnly ) {
557  $wgDebugLogGroups['profileoutput'] = $wgDebugLogFile;
558  $wgDebugLogFile = '';
559 }
560 
561 // Backwards compatibility with old password limits
562 if ( $wgMinimalPasswordLength !== false ) {
563  $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength;
564 }
565 
566 if ( $wgMaximalPasswordLength !== false ) {
567  $wgPasswordPolicy['policies']['default']['MaximalPasswordLength'] = $wgMaximalPasswordLength;
568 }
569 
570 // Backwards compatibility warning
571 if ( !$wgSessionsInObjectCache ) {
572  wfDeprecated( '$wgSessionsInObjectCache = false', '1.27' );
573  if ( $wgSessionHandler ) {
574  wfDeprecated( '$wgSessionsHandler', '1.27' );
575  }
576  $cacheType = get_class( ObjectCache::getInstance( $wgSessionCacheType ) );
577  wfDebugLog(
578  'caches',
579  "Session data will be stored in \"$cacheType\" cache with " .
580  "expiry $wgObjectCacheSessionExpiry seconds"
581  );
582 }
584 
585 if ( $wgPHPSessionHandling !== 'enable' &&
586  $wgPHPSessionHandling !== 'warn' &&
587  $wgPHPSessionHandling !== 'disable'
588 ) {
589  $wgPHPSessionHandling = 'warn';
590 }
591 if ( defined( 'MW_NO_SESSION' ) ) {
592  // If the entry point wants no session, force 'disable' here unless they
593  // specifically set it to the (undocumented) 'warn'.
594  $wgPHPSessionHandling = MW_NO_SESSION === 'warn' ? 'warn' : 'disable';
595 }
596 
597 Profiler::instance()->scopedProfileOut( $ps_default );
598 
599 // Disable MWDebug for command line mode, this prevents MWDebug from eating up
600 // all the memory from logging SQL queries on maintenance scripts
603  MWDebug::init();
604 }
605 
606 // Reset the global service locator, so any services that have already been created will be
607 // re-created while taking into account any custom settings and extensions.
608 MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
609 
610 if ( $wgSharedDB && $wgSharedTables ) {
611  // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
612  MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
613  array_fill_keys(
615  [
616  'dbname' => $wgSharedDB,
617  'schema' => $wgSharedSchema,
618  'prefix' => $wgSharedPrefix
619  ]
620  )
621  );
622 }
623 
624 // Define a constant that indicates that the bootstrapping of the service locator
625 // is complete.
626 define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
627 
629 
630 require_once "$IP/includes/compat/normal/UtfNormalUtil.php";
631 
632 $ps_validation = Profiler::instance()->scopedProfileIn( $fname . '-validation' );
633 
634 // T48998: Bail out early if $wgArticlePath is non-absolute
635 foreach ( [ 'wgArticlePath', 'wgVariantArticlePath' ] as $varName ) {
636  if ( $$varName && !preg_match( '/^(https?:\/\/|\/)/', $$varName ) ) {
637  throw new FatalError(
638  "If you use a relative URL for \$$varName, it must start " .
639  'with a slash (<code>/</code>).<br><br>See ' .
640  "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
641  "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
642  );
643  }
644 }
645 
646 Profiler::instance()->scopedProfileOut( $ps_validation );
647 
648 $ps_default2 = Profiler::instance()->scopedProfileIn( $fname . '-defaults2' );
649 
650 if ( $wgCanonicalServer === false ) {
652 }
653 
654 // Set server name
656 if ( $wgServerName !== false ) {
657  wfWarn( '$wgServerName should be derived from $wgCanonicalServer, '
658  . 'not customized. Overwriting $wgServerName.' );
659 }
661 unset( $serverParts );
662 
663 // Set defaults for configuration variables
664 // that are derived from the server name by default
665 // Note: $wgEmergencyContact and $wgPasswordSender may be false or empty string (T104142)
666 if ( !$wgEmergencyContact ) {
667  $wgEmergencyContact = 'wikiadmin@' . $wgServerName;
668 }
669 if ( !$wgPasswordSender ) {
670  $wgPasswordSender = 'apache@' . $wgServerName;
671 }
672 if ( !$wgNoReplyAddress ) {
674 }
675 
676 if ( $wgSecureLogin && substr( $wgServer, 0, 2 ) !== '//' ) {
677  $wgSecureLogin = false;
678  wfWarn( 'Secure login was enabled on a server that only supports '
679  . 'HTTP or HTTPS. Disabling secure login.' );
680 }
681 
683 
684 // Now that GlobalFunctions is loaded, set defaults that depend on it.
685 if ( $wgTmpDirectory === false ) {
687 }
688 
689 // We don't use counters anymore. Left here for extensions still
690 // expecting this to exist. Should be removed sometime 1.26 or later.
691 if ( !isset( $wgDisableCounters ) ) {
692  $wgDisableCounters = true;
693 }
694 
695 if ( $wgMainWANCache === false ) {
696  // Setup a WAN cache from $wgMainCacheType with no relayer.
697  // Sites using multiple datacenters can configure a relayer.
698  $wgMainWANCache = 'mediawiki-main-default';
700  'class' => WANObjectCache::class,
701  'cacheId' => $wgMainCacheType,
702  'channels' => [ 'purge' => 'wancache-main-default-purge' ]
703  ];
704 }
705 
706 Profiler::instance()->scopedProfileOut( $ps_default2 );
707 
708 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );
709 
710 // Raise the memory limit if it's too low
711 wfMemoryLimit();
712 
718 if ( is_null( $wgLocaltimezone ) ) {
719  Wikimedia\suppressWarnings();
720  $wgLocaltimezone = date_default_timezone_get();
721  Wikimedia\restoreWarnings();
722 }
723 
724 date_default_timezone_set( $wgLocaltimezone );
725 if ( is_null( $wgLocalTZoffset ) ) {
726  $wgLocalTZoffset = date( 'Z' ) / 60;
727 }
728 // The part after the System| is ignored, but rest of MW fills it
729 // out as the local offset.
730 $wgDefaultUserOptions['timecorrection'] = "System|$wgLocalTZoffset";
731 
732 if ( !$wgDBerrorLogTZ ) {
734 }
735 
736 // Initialize the request object in $wgRequest
737 $wgRequest = RequestContext::getMain()->getRequest(); // BackCompat
738 // Set user IP/agent information for agent session consistency purposes
739 MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
740  'IPAddress' => $wgRequest->getIP(),
741  'UserAgent' => $wgRequest->getHeader( 'User-Agent' ),
742  'ChronologyProtection' => $wgRequest->getHeader( 'ChronologyProtection' ),
743  // The cpPosIndex cookie has no prefix and is set by MediaWiki::preOutputCommit()
744  'ChronologyPositionIndex' =>
745  $wgRequest->getInt( 'cpPosIndex', (int)$wgRequest->getCookie( 'cpPosIndex', '' ) )
746 ] );
747 // Make sure that object caching does not undermine the ChronologyProtector improvements
748 if ( $wgRequest->getCookie( 'UseDC', '' ) === 'master' ) {
749  // The user is pinned to the primary DC, meaning that they made recent changes which should
750  // be reflected in their subsequent web requests. Avoid the use of interim cache keys because
751  // they use a blind TTL and could be stale if an object changes twice in a short time span.
752  MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching( false );
753 }
754 
755 // Useful debug output
756 if ( $wgCommandLineMode ) {
757  wfDebug( "\n\nStart command line script $self\n" );
758 } else {
759  $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
760 
761  if ( $wgDebugPrintHttpHeaders ) {
762  $debug .= "HTTP HEADERS:\n";
763 
764  foreach ( $wgRequest->getAllHeaders() as $name => $value ) {
765  $debug .= "$name: $value\n";
766  }
767  }
768  wfDebug( $debug );
769 }
770 
771 Profiler::instance()->scopedProfileOut( $ps_misc );
772 $ps_memcached = Profiler::instance()->scopedProfileIn( $fname . '-memcached' );
773 
776 
780 $parserMemc = new DeprecatedGlobal( 'parserMemc', function () {
781  return MediaWikiServices::getInstance()->getParserCache()->getCacheStorage();
782 }, '1.30' );
783 
784 wfDebugLog( 'caches',
785  'cluster: ' . get_class( $wgMemc ) .
786  ', WAN: ' . ( $wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache ) .
787  ', stash: ' . $wgMainStash .
788  ', message: ' . get_class( $messageMemc ) .
789  ', session: ' . get_class( ObjectCache::getInstance( $wgSessionCacheType ) )
790 );
791 
792 Profiler::instance()->scopedProfileOut( $ps_memcached );
793 
794 // Most of the config is out, some might want to run hooks here.
795 Hooks::run( 'SetupAfterCache' );
796 
797 $ps_globals = Profiler::instance()->scopedProfileIn( $fname . '-globals' );
798 
803 $wgContLang->initContLang();
804 
805 // Now that variant lists may be available...
806 $wgRequest->interpolateTitle();
807 
808 if ( !is_object( $wgAuth ) ) {
810  Hooks::run( 'AuthPluginSetup', [ &$wgAuth ] );
811 }
812 if ( $wgAuth && !$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin ) {
813  MediaWiki\Auth\AuthManager::singleton()->forcePrimaryAuthenticationProviders( [
814  new MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider( [
815  'authoritative' => false,
816  ] ),
817  new MediaWiki\Auth\AuthPluginPrimaryAuthenticationProvider( $wgAuth ),
818  new MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider( [
819  'authoritative' => true,
820  ] ),
821  ], '$wgAuth is ' . get_class( $wgAuth ) );
822 }
823 
824 // Set up the session
825 $ps_session = Profiler::instance()->scopedProfileIn( $fname . '-session' );
831 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
832  // If session.auto_start is there, we can't touch session name
833  if ( $wgPHPSessionHandling !== 'disable' && !wfIniGetBool( 'session.auto_start' ) ) {
834  session_name( $wgSessionName ? $wgSessionName : $wgCookiePrefix . '_session' );
835  }
836 
837  // Create the SessionManager singleton and set up our session handler,
838  // unless we're specifically asked not to.
839  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
841  MediaWiki\Session\SessionManager::singleton()
842  );
843  }
844 
845  // Initialize the session
846  try {
848  } catch ( OverflowException $ex ) {
849  if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
850  // The exception is because the request had multiple possible
851  // sessions tied for top priority. Report this to the user.
852  $list = [];
853  foreach ( $ex->sessionInfos as $info ) {
854  $list[] = $info->getProvider()->describe( $wgContLang );
855  }
856  $list = $wgContLang->listToText( $list );
857  throw new HttpError( 400,
858  Message::newFromKey( 'sessionmanager-tie', $list )->inLanguage( $wgContLang )->plain()
859  );
860  }
861 
862  // Not the one we want, rethrow
863  throw $ex;
864  }
865 
866  if ( $session->isPersistent() ) {
867  $wgInitialSessionId = $session->getSessionId();
868  }
869 
870  $session->renew();
871  if ( MediaWiki\Session\PHPSessionHandler::isEnabled() &&
872  ( $session->isPersistent() || $session->shouldRememberUser() ) &&
873  session_id() !== $session->getId()
874  ) {
875  // Start the PHP-session for backwards compatibility
876  if ( session_id() !== '' ) {
877  wfDebugLog( 'session', 'PHP session {old_id} was already started, changing to {new_id}', 'all', [
878  'old_id' => session_id(),
879  'new_id' => $session->getId(),
880  ] );
881  session_write_close();
882  }
883  session_id( $session->getId() );
884  session_start();
885  }
886 
887  unset( $session );
888 } else {
889  // Even if we didn't set up a global Session, still install our session
890  // handler unless specifically requested not to.
891  if ( !defined( 'MW_NO_SESSION_HANDLER' ) ) {
893  MediaWiki\Session\SessionManager::singleton()
894  );
895  }
896 }
897 Profiler::instance()->scopedProfileOut( $ps_session );
898 
902 $wgUser = RequestContext::getMain()->getUser(); // BackCompat
903 
908 
912 $wgOut = RequestContext::getMain()->getOutput(); // BackCompat
913 
917 $wgParser = new StubObject( 'wgParser', function () {
918  return MediaWikiServices::getInstance()->getParser();
919 } );
920 
924 $wgTitle = null;
925 
926 Profiler::instance()->scopedProfileOut( $ps_globals );
927 $ps_extensions = Profiler::instance()->scopedProfileIn( $fname . '-extensions' );
928 
929 // Extension setup functions
930 // Entries should be added to this variable during the inclusion
931 // of the extension file. This allows the extension to perform
932 // any necessary initialisation in the fully initialised environment
933 foreach ( $wgExtensionFunctions as $func ) {
934  // Allow closures in PHP 5.3+
935  if ( is_object( $func ) && $func instanceof Closure ) {
936  $profName = $fname . '-extensions-closure';
937  } elseif ( is_array( $func ) ) {
938  if ( is_object( $func[0] ) ) {
939  $profName = $fname . '-extensions-' . get_class( $func[0] ) . '::' . $func[1];
940  } else {
941  $profName = $fname . '-extensions-' . implode( '::', $func );
942  }
943  } else {
944  $profName = $fname . '-extensions-' . strval( $func );
945  }
946 
947  $ps_ext_func = Profiler::instance()->scopedProfileIn( $profName );
948  call_user_func( $func );
949  Profiler::instance()->scopedProfileOut( $ps_ext_func );
950 }
951 
952 // If the session user has a 0 id but a valid name, that means we need to
953 // autocreate it.
954 if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
955  $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
956  if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) {
957  $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' );
958  $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
959  $sessionUser,
960  MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
961  true
962  );
963  Profiler::instance()->scopedProfileOut( $ps_autocreate );
964  \MediaWiki\Logger\LoggerFactory::getInstance( 'authevents' )->info( 'Autocreation attempt', [
965  'event' => 'autocreate',
966  'status' => $res,
967  ] );
968  unset( $res );
969  }
970  unset( $sessionUser );
971 }
972 
973 if ( !$wgCommandLineMode ) {
975 }
976 
978 
979 Profiler::instance()->scopedProfileOut( $ps_extensions );
980 Profiler::instance()->scopedProfileOut( $ps_setup );
$wgCanonicalNamespaceNames
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
Definition: Setup.php:479
$wgLocalInterwiki
$wgLocalInterwiki
The interwiki prefix of the current wiki, or false if it doesn't have one.
Definition: DefaultSettings.php:3949
LanguageCode\getDeprecatedCodeMapping
static getDeprecatedCodeMapping()
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up...
Definition: LanguageCode.php:63
$ps_session
if(!is_object( $wgAuth)) if( $wgAuth &&! $wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin) $ps_session
Definition: Setup.php:825
MediaWiki\HeaderCallback\register
static register()
Register a callback to be called when headers are sent.
Definition: HeaderCallback.php:14
$wgUser
$wgUser
Definition: Setup.php:902
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:445
$wgMaximalPasswordLength
$wgMaximalPasswordLength
Specifies the maximal length of a user password (T64685).
Definition: DefaultSettings.php:4741
MW_NO_SESSION
const MW_NO_SESSION
Definition: load.php:30
$wgDBserver
$wgDBserver
Database host name or IP address.
Definition: DefaultSettings.php:1794
$wgFileBlacklist
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
Definition: DefaultSettings.php:896
$wgActionPaths
$wgActionPaths
Definition: img_auth.php:46
NS_HELP
const NS_HELP
Definition: Defines.php:86
$wgRCLinkDays
$wgRCLinkDays
List of Days options to list in the Special:Recentchanges and Special:Recentchangeslinked pages.
Definition: DefaultSettings.php:6772
use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: APACHE-LICENSE-2.0.txt:10
$wgResourceLoaderMaxQueryLength
$wgResourceLoaderMaxQueryLength
If set to a positive number, ResourceLoader will not generate URLs whose query string is more than th...
Definition: DefaultSettings.php:3743
$wgProfileOnly
$wgProfileOnly
Don't put non-profiling info into log file.
Definition: DefaultSettings.php:6364
$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:237
$wgExperimentalHtmlIds
$wgExperimentalHtmlIds
Abandoned experiment with HTML5-style ID escaping.
Definition: DefaultSettings.php:3383
$wgCookiePrefix
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
Definition: Setup.php:424
$wgMinUploadChunkSize
if( $wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Definition: Setup.php:465
$wgParser
$wgParser
Definition: Setup.php:917
$wgEnotifFromEditor
$wgEnotifFromEditor
Definition: Setup.php:434
$wgInvalidateCacheOnLocalSettingsChange
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
Definition: DefaultSettings.php:2643
$wgGalleryOptions
$wgGalleryOptions
Default parameters for the "<gallery>" tag.
Definition: Setup.php:264
$wgTmpDirectory
$wgTmpDirectory
The local filesystem path to a temporary directory.
Definition: DefaultSettings.php:359
$wgRightsText
$wgRightsText
If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link.
Definition: DefaultSettings.php:7116
Profiler\instance
static instance()
Singleton.
Definition: Profiler.php:62
$wgEnotifWatchlist
$wgEnotifWatchlist
Definition: Setup.php:441
$wgSharedTables
$wgSharedTables
Definition: DefaultSettings.php:1931
plain
either a plain
Definition: hooks.txt:2056
$wgSharedSchema
$wgSharedSchema
Definition: DefaultSettings.php:1937
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:527
NS_TEMPLATE_TALK
const NS_TEMPLATE_TALK
Definition: Defines.php:85
$wgLogHeaders
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type.
Definition: DefaultSettings.php:7736
$wgDefaultUserOptions
if( $wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
Definition: Setup.php:382
$wgUserEmailUseReplyTo
$wgUserEmailUseReplyTo
Definition: Setup.php:444
$wgScript
$wgScript
The URL path to index.php.
Definition: DefaultSettings.php:206
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:112
$ps_misc
$ps_misc
Definition: Setup.php:708
$wgDBtype
$wgDBtype
Database type.
Definition: DefaultSettings.php:1819
MediaWiki\Auth\AuthManagerAuthPlugin
Backwards-compatibility wrapper for AuthManager via $wgAuth.
Definition: AuthManagerAuthPlugin.php:31
$wgSharedDB
$wgSharedDB
Shared database for multiple wikis.
Definition: DefaultSettings.php:1921
$wgLocalFileRepo
$wgLocalFileRepo
File repository structures.
Definition: DefaultSettings.php:539
$ps_memcached
$ps_memcached
Definition: Setup.php:772
$wgWANObjectCaches
$wgWANObjectCaches
Advanced WAN object cache configuration.
Definition: DefaultSettings.php:2381
$wgLang
$wgLang
Definition: Setup.php:907
$wgVersion
$wgVersion
MediaWiki version number.
Definition: DefaultSettings.php:75
$wgHtml5
if( $wgUseFileCache|| $wgUseSquid) $wgHtml5
Definition: Setup.php:522
$wgSharedUploadDBprefix
$wgSharedUploadDBprefix
Optional table prefix used in database.
Definition: DefaultSettings.php:739
DBO_DEBUG
const DBO_DEBUG
Definition: defines.php:9
UploadBase\getMaxPhpUploadSize
static getMaxPhpUploadSize()
Get the PHP maximum uploaded file size, based on ini settings.
Definition: UploadBase.php:2195
$wgContLanguageCode
$wgContLanguageCode
Definition: Setup.php:512
$wgDBmwschema
$wgDBmwschema
Mediawiki schema.
Definition: DefaultSettings.php:1889
$wgVirtualRestConfig
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//') $wgVirtualRestConfig['global']['domain']
Definition: Setup.php:682
$wgGenerateThumbnailOnParse
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
Definition: DefaultSettings.php:1251
$wgEnableUserEmail
$wgEnableUserEmail
Definition: Setup.php:433
$wgUseSharedUploads
$wgUseSharedUploads
If you operate multiple wikis, you can define a shared upload path here.
Definition: DefaultSettings.php:713
NS_FILE
const NS_FILE
Definition: Defines.php:80
$wgExtensionAssetsPath
$wgExtensionAssetsPath
The URL path of the extensions directory.
Definition: DefaultSettings.php:236
NS_TEMPLATE
const NS_TEMPLATE
Definition: Defines.php:84
MWExceptionHandler\installHandler
static installHandler()
Install handlers with PHP.
Definition: MWExceptionHandler.php:53
WebRequest\detectProtocol
static detectProtocol()
Detect the protocol from $_SERVER.
Definition: WebRequest.php:242
$wgUseSquid
$wgUseSquid
Enable/disable CDN.
Definition: DefaultSettings.php:2681
$wgFragmentMode
$wgFragmentMode
How should section IDs be encoded? This array can contain 1 or 2 elements, each of them can be one of...
Definition: DefaultSettings.php:3415
$wgHashedSharedUploadDirectory
$wgHashedSharedUploadDirectory
Set the following to false especially if you have a set of files that need to be accessible by all wi...
Definition: DefaultSettings.php:869
$res
$res
Definition: database.txt:21
$wgCacheDirectory
$wgCacheDirectory
Directory for caching data in the local filesystem.
Definition: DefaultSettings.php:2252
User\isValidUserName
static isValidUserName( $name)
Is the input a valid username?
Definition: User.php:969
$wgLogo
$wgLogo
The URL path of the wiki logo.
Definition: DefaultSettings.php:282
$wgEnableParserCache
$wgEnableParserCache
Kept for extension compatibility; see $wgParserCacheType.
Definition: DefaultSettings.php:2594
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:1087
$wgMetaNamespace
$wgMetaNamespace
Name of the project namespace.
Definition: DefaultSettings.php:3851
HttpError
Show an error that looks like an HTTP server error.
Definition: HttpError.php:30
$wgDBpassword
$wgDBpassword
Database user's password.
Definition: DefaultSettings.php:1814
$wgDBprefix
$wgDBprefix
Table name prefix.
Definition: DefaultSettings.php:1871
$wgStylePath
$wgStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:221
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:37
$wgMemc
$wgMemc
Definition: Setup.php:774
$debug
$debug
Definition: mcc.php:31
$wgRepositoryBaseUrl
$wgRepositoryBaseUrl
Base URL for a repository wiki.
Definition: DefaultSettings.php:879
$wgUseInstantCommons
$wgUseInstantCommons
Use Commons as a remote 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:862
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:63
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:801
$wgNoReplyAddress
$wgNoReplyAddress
Reply-To address for e-mail notifications.
Definition: DefaultSettings.php:1613
wfGetMainCache
wfGetMainCache()
Get the main cache object.
Definition: GlobalFunctions.php:3147
$wgEnotifMaxRecips
$wgEnotifMaxRecips
Definition: Setup.php:436
$wgSharedUploadPath
$wgSharedUploadPath
Full path on the web server where shared uploads can be found.
Definition: DefaultSettings.php:718
NS_PROJECT
const NS_PROJECT
Definition: Defines.php:78
$wgDBname
controlled by $wgMainCacheType controlled by $wgParserCacheType controlled by $wgMessageCacheType If you set CACHE_NONE to one of the three control default value for MediaWiki still create a but requests to it are no ops and we always fall through to the database If the cache daemon can t be it should also disable itself fairly smoothly By $wgMemc is used but when it is $parserMemc or $messageMemc this is mentioned $wgDBname
Definition: memcached.txt:138
$wgEmergencyContact
$wgEmergencyContact
Site admin email address.
Definition: DefaultSettings.php:1590
wfDeprecated
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
Definition: GlobalFunctions.php:1123
$wgFooterIcons
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
Definition: DefaultSettings.php:3457
$ps_default
$ps_default
Definition: Setup.php:133
$wgUseFileCache
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
Definition: DefaultSettings.php:2580
$wgCommandLineMode
global $wgCommandLineMode
Definition: Setup.php:601
$ps_validation
$ps_validation
Definition: Setup.php:632
$parserMemc
$parserMemc
Definition: Setup.php:780
NS_MEDIAWIKI_TALK
const NS_MEDIAWIKI_TALK
Definition: Defines.php:83
$wgDebugLogGroups
$wgDebugLogGroups
Map of string log group names to log destinations.
Definition: DefaultSettings.php:6241
MW_CONFIG_CALLBACK
const MW_CONFIG_CALLBACK
Definition: install.php:26
$wgEnotifUserTalk
$wgEnotifUserTalk
Definition: Setup.php:440
$wgLoadScript
$wgLoadScript
The URL path to load.php.
Definition: DefaultSettings.php:214
MediaWiki
A helper class for throttling authentication attempts.
$wgSharedPrefix
$wgSharedPrefix
Definition: DefaultSettings.php:1926
ObjectCache\getInstance
static getInstance( $id)
Get a cached instance of the specified type of cache object.
Definition: ObjectCache.php:92
$wgFetchCommonsDescriptions
$wgFetchCommonsDescriptions
Fetch commons image description pages and display them on the local wiki?
Definition: DefaultSettings.php:723
$wgLogTypes
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
Definition: DefaultSettings.php:7652
$wgParserCacheType
$wgParserCacheType
The cache type for storing article HTML.
Definition: DefaultSettings.php:2287
$wgEnotifUseRealName
$wgEnotifUseRealName
Definition: Setup.php:439
$wgEnableEmail
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
Definition: DefaultSettings.php:1620
GlobalVarConfig
Accesses configuration settings from $GLOBALS.
Definition: GlobalVarConfig.php:28
$wgSessionName
$wgSessionName
Override to customise the session name.
Definition: DefaultSettings.php:6076
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:95
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:88
wfMemoryLimit
wfMemoryLimit()
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
Definition: GlobalFunctions.php:3045
$wgDebugLogFile
$wgDebugLogFile
Filename for debug logging.
Definition: DefaultSettings.php:6117
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:994
$wgDummyLanguageCodes
if(is_array( $wgExtraNamespaces)) $wgDummyLanguageCodes
Definition: Setup.php:505
$wgCanonicalServer
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
Definition: DefaultSettings.php:115
$wgSkipSkin
$wgSkipSkin
Definition: DefaultSettings.php:3298
$wgEnotifRevealEditorAddress
$wgEnotifRevealEditorAddress
Definition: Setup.php:438
$wgLockManagers
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
Definition: Setup.php:250
$wgCacheSharedUploads
$wgCacheSharedUploads
Cache shared metadata in memcached.
Definition: DefaultSettings.php:745
$wgFullyInitialised
foreach( $wgExtensionFunctions as $func) if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised
Definition: Setup.php:977
$fname
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition: Setup.php:112
$wgPageLanguageUseDB
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
Definition: DefaultSettings.php:8664
$ps_default2
$ps_default2
Definition: Setup.php:648
$wgEnotifMinorEdits
$wgEnotifMinorEdits
Definition: Setup.php:437
MediaWiki\Session\SessionManager\getGlobalSession
static getGlobalSession()
Get the "global" session.
Definition: SessionManager.php:107
$wgTitle
$wgTitle
Definition: Setup.php:924
$wgSessionHandler
$wgSessionHandler
Definition: DefaultSettings.php:2444
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:77
$wgDebugPrintHttpHeaders
$wgDebugPrintHttpHeaders
Print HTTP headers for every request in the debug information.
Definition: DefaultSettings.php:6284
$messageMemc
$messageMemc
Definition: Setup.php:775
$value
$value
Definition: styleTest.css.php:45
$wgLocalTZoffset
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
Definition: DefaultSettings.php:3168
NS_MEDIA
const NS_MEDIA
Definition: Defines.php:62
$wgForceHTTPS
bool $wgForceHTTPS
If this is true, when an insecure HTTP request is received, always redirect to HTTPS.
Definition: DefaultSettings.php:147
$wgNamespaceAliases
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
Definition: Setup.php:244
$wgLocalInterwikis
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
Definition: DefaultSettings.php:3959
$wgDeletedDirectory
$wgDeletedDirectory
What directory to place deleted uploads in.
Definition: DefaultSettings.php:438
StubUserLang
Stub object for the user language.
Definition: StubObject.php:178
$wgServer
$wgServer
URL of the server.
Definition: DefaultSettings.php:106
DeprecatedGlobal
Class to allow throwing wfDeprecated warnings when people use globals that we do not want them to.
Definition: DeprecatedGlobal.php:27
$wgRCMaxAge
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go.
Definition: DefaultSettings.php:6736
$wgLanguageCode
$wgLanguageCode
Site language code.
Definition: DefaultSettings.php:2887
$rcMaxAgeDays
if( $wgExperimentalHtmlIds) $rcMaxAgeDays
Definition: Setup.php:366
$wgSitename
$wgSitename
Name of the site.
Definition: DefaultSettings.php:80
$wgRightsIcon
$wgRightsIcon
Override for copyright metadata.
Definition: DefaultSettings.php:7121
PROTO_HTTP
const PROTO_HTTP
Definition: Defines.php:229
$wgJsMimeType
$wgJsMimeType
Definition: Setup.php:524
NS_PROJECT_TALK
const NS_PROJECT_TALK
Definition: Defines.php:79
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:7244
$wgSessionsInObjectCache
if( $wgInvalidateCacheOnLocalSettingsChange) if( $wgNewUserLog) if( $wgPageLanguageUseDB) if( $wgCookieSecure==='detect') if( $wgProfileOnly) if( $wgMinimalPasswordLength !==false) if( $wgMaximalPasswordLength !==false) if(! $wgSessionsInObjectCache) $wgSessionsInObjectCache
Definition: Setup.php:583
$wgEmailAuthentication
$wgEmailAuthentication
Definition: Setup.php:432
$wgUploadBaseUrl
$wgUploadBaseUrl
If set, this URL is added to the start of $wgUploadPath to form a complete upload URL.
Definition: DefaultSettings.php:366
$wgUploadDirectory
$wgUploadDirectory
The filesystem path of the images directory.
Definition: DefaultSettings.php:270
$wgAllowHTMLEmail
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
Definition: DefaultSettings.php:1702
$wgProfiler
if(!defined( 'MEDIAWIKI')) $wgProfiler
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition: Setup.php:41
RequestContext\getMain
static getMain()
Get the RequestContext object associated with the main request.
Definition: RequestContext.php:434
$wgLogActionsHandlers
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
Definition: DefaultSettings.php:7764
wfIniGetBool
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
Definition: GlobalFunctions.php:2172
$wgResourceBasePath
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
Definition: DefaultSettings.php:3660
UploadBase\getMaxUploadSize
static getMaxUploadSize( $forType=null)
Get the MediaWiki maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
Definition: UploadBase.php:2174
$serverParts
if( $wgCanonicalServer===false) $serverParts
Definition: Setup.php:655
$wgUseEnotif
$wgUseEnotif
Definition: Setup.php:443
$wgSessionCacheType
$wgSessionCacheType
The cache type for storing session data.
Definition: DefaultSettings.php:2294
$wgArticlePath
$wgArticlePath
Definition: img_auth.php:45
$ps_setup
$ps_setup
Definition: Setup.php:113
wfGetMessageCacheStorage
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
Definition: GlobalFunctions.php:3157
$wgCacheEpoch
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
Definition: DefaultSettings.php:2556
wfShorthandToInteger
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:3094
$wgGitInfoCacheDirectory
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
Definition: DefaultSettings.php:2562
$wgXhtmlDefaultNamespace
$wgXhtmlDefaultNamespace
Definition: Setup.php:523
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
$wgSharedUploadDBname
$wgSharedUploadDBname
DB name with metadata about shared directory.
Definition: DefaultSettings.php:734
wfTempDir
wfTempDir()
Tries to get the system directory for temporary files.
Definition: GlobalFunctions.php:2057
$wgSharedUploadDirectory
$wgSharedUploadDirectory
Path on the file system where shared uploads can be found.
Definition: DefaultSettings.php:728
$wgReadOnlyFile
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode.
Definition: DefaultSettings.php:6686
$wgSkipSkins
if( $wgSkipSkin) $wgSkipSkins[]
Definition: Setup.php:396
NS_HELP_TALK
const NS_HELP_TALK
Definition: Defines.php:87
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:842
$wgGroupPermissions
$wgGroupPermissions
Permission keys given to users in each group.
Definition: DefaultSettings.php:5123
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:3157
$wgEnotifImpersonal
$wgEnotifImpersonal
Definition: Setup.php:435
$wgMainCacheType
CACHE_MEMCACHED $wgMainCacheType
Definition: memcached.txt:63
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:22
$wgCookieSecure
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
Definition: DefaultSettings.php:6022
$ps_globals
$ps_globals
Definition: Setup.php:797
$wgShellLocale
$wgShellLocale
Locale for LC_ALL, to provide a known environment for locale-sensitive operations.
Definition: DefaultSettings.php:8337
NS_USER
const NS_USER
Definition: Defines.php:76
$ps_extensions
$ps_extensions
Definition: Setup.php:927
NS_TALK
const NS_TALK
Definition: Defines.php:75
$wgLogNames
$wgLogNames
Lists the message key string for each log type.
Definition: DefaultSettings.php:7713
$wgFileCacheDirectory
$wgFileCacheDirectory
Directory where the cached page will be saved.
Definition: DefaultSettings.php:276
$wgUploadPath
$wgUploadPath
The URL path for the images directory.
Definition: DefaultSettings.php:265
Language\factory
static factory( $code)
Get a cached or new language object for a given language code.
Definition: Language.php:183
wfWarn
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
Definition: GlobalFunctions.php:1137
NS_MEDIAWIKI
const NS_MEDIAWIKI
Definition: Defines.php:82
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:56
$wgDBuser
$wgDBuser
Database username.
Definition: DefaultSettings.php:1809
$wgAuth
$wgAuth $wgAuth
Authentication plugin.
Definition: DefaultSettings.php:7418
$wgDBerrorLogTZ
$wgDBerrorLogTZ
Timezone to use in the error log.
Definition: DefaultSettings.php:2039
$wgPasswordPolicy
$wgPasswordPolicy
Password policy for local wiki users.
Definition: DefaultSettings.php:4509
$wgDebugDumpSql
$wgDebugDumpSql
Write SQL queries to the debug log.
Definition: DefaultSettings.php:6156
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:737
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:25
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:4728
$wgRCFilterByAge
$wgRCFilterByAge
Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be store...
Definition: DefaultSettings.php:6760
$wgServerName
if( $wgServerName !==false) $wgServerName
Definition: Setup.php:660
$wgDebugToolbar
$wgDebugToolbar
Display the new debugging toolbar.
Definition: DefaultSettings.php:6445
NS_FILE_TALK
const NS_FILE_TALK
Definition: Defines.php:81
$wgOut
$wgOut
Definition: Setup.php:912
NS_CATEGORY_TALK
const NS_CATEGORY_TALK
Definition: Defines.php:89
$wgPasswordSender
$wgPasswordSender
Sender email address for e-mail notifications.
Definition: DefaultSettings.php:1599
$wgContLang
$wgContLang
Definition: Setup.php:802
$wgPHPSessionHandling
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
Definition: DefaultSettings.php:2462
$wgExtraLanguageCodes
$wgExtraLanguageCodes
List of mappings from one language code to another.
Definition: DefaultSettings.php:2949
$wgScriptPath
$wgScriptPath
The path we should point to.
Definition: DefaultSettings.php:158
DBO_DEFAULT
const DBO_DEFAULT
Definition: defines.php:13
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:203
$wgForeignFileRepos
$wgForeignFileRepos
Definition: DefaultSettings.php:544
Message\newFromKey
static newFromKey( $key)
Factory function that is just wrapper for the real constructor.
Definition: Message.php:395
$wgLocalStylePath
$wgLocalStylePath
The URL path of the skins directory.
Definition: DefaultSettings.php:229
$wgSecureLogin
$wgSecureLogin
This is to let user authenticate using https when they come from http.
Definition: DefaultSettings.php:4949
$wgMainStash
$wgMainStash
Main object stash type.
Definition: DefaultSettings.php:2423
$wgExtraNamespaces
$wgExtraNamespaces
Additional namespaces.
Definition: DefaultSettings.php:3888
$wgInitialSessionId
$wgInitialSessionId
Definition: Setup.php:830
$wgNewUserLog
$wgNewUserLog
Maintain a log of newusers at Log/newusers?
Definition: DefaultSettings.php:7878
$wgMainWANCache
$wgMainWANCache
Main Wide-Area-Network cache type.
Definition: DefaultSettings.php:2364
wfExpandUrl
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
Definition: GlobalFunctions.php:521
$wgRightsUrl
$wgRightsUrl
Set this to specify an external URL containing details about the content license used on your wiki.
Definition: DefaultSettings.php:7108
$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:177
$wgSharedThumbnailScriptPath
$wgSharedThumbnailScriptPath
Definition: DefaultSettings.php:847