34if ( !defined(
'MEDIAWIKI' ) ) {
41 echo
"Error, Setup.php must be included from the file scope.\n";
51if (
ini_get(
'mbstring.func_overload' ) ) {
52 die(
'MediaWiki does not support installations where mbstring.func_overload is non-zero.' );
56require_once
"$IP/includes/AutoLoader.php";
59require_once
"$IP/includes/Defines.php";
62require_once
"$IP/includes/DefaultSettings.php";
65require_once
"$IP/includes/GlobalFunctions.php";
69 require_once
"$IP/vendor/autoload.php";
71 die(
"$IP/vendor/autoload.php exists but is not readable" );
80 'MediaWiki requires the <a href="https://github.com/php-fig/log">PSR-3 logging ' .
81 "library</a> to be present. This library is not embedded directly in MediaWiki's " .
82 "git repository and must be installed separately by the end user.\n\n" .
83 'Please see <a href="https://www.mediawiki.org/wiki/Download_from_Git' .
84 '#Fetch_external_libraries">mediawiki.org</a> for help on installing ' .
85 'the required components.'
93MediaWiki\HeaderCallback::register();
99if ( defined(
'MW_CONFIG_CALLBACK' ) ) {
102 if ( !defined(
'MW_CONFIG_FILE' ) ) {
103 define(
'MW_CONFIG_FILE',
"$IP/LocalSettings.php" );
115if ( defined(
'MW_SETUP_CALLBACK' ) ) {
134putenv(
"LC_ALL=$wgShellLocale" );
176 $wgLogo =
"$wgResourceBasePath/resources/assets/wiki.png";
202 "{$wgStylePath}/common/images/",
203 "{$wgResourceBasePath}/resources/assets/licenses/",
225 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
227 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
228 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
252 'name' =>
'fsLockManager',
253 'class' => FSLockManager::class,
254 'lockDirectory' =>
"{$wgUploadDirectory}/lockdir",
257 'name' =>
'nullLockManager',
258 'class' => NullLockManager::class,
268 'imageHeight' => 120,
269 'captionLength' =>
true,
271 'showDimensions' =>
true,
272 'mode' =>
'traditional',
280 'class' => LocalRepo::class,
305 'class' => ForeignDBRepo::class,
325 'class' => FileRepo::class,
339 'class' => ForeignAPIRepo::class,
340 'name' =>
'wikimediacommons',
341 'apibase' =>
'https://commons.wikimedia.org/w/api.php',
342 'url' =>
'https://upload.wikimedia.org/wikipedia/commons',
343 'thumbUrl' =>
'https://upload.wikimedia.org/wikipedia/commons/thumb',
345 'transformVia404' =>
true,
346 'fetchDescription' =>
true,
347 'descriptionCacheExpiry' => 43200,
348 'apiThumbCacheExpiry' => 0,
352 if ( !
isset( $repo[
'directory'] ) && $repo[
'class'] === ForeignAPIRepo::class ) {
355 if ( !
isset( $repo[
'backend'] ) ) {
356 $repo[
'backend'] = $repo[
'name'] .
'-backend';
448 $suhosinMaxValueLength = (
int)
ini_get(
'suhosin.get.max_value_length' );
449 if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
454 unset( $suhosinMaxValueLength );
464 ini_get(
'post_max_size' ) ?: ini_get(
'hhvm.server.max_post_size' ),
466 ) ?: PHP_INT_MAX ) - 1024
483 NS_MEDIAWIKI =>
'MediaWiki',
510foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as
$code => $bcp47 ) {
589if ( defined(
'MW_NO_SESSION' ) ) {
606MediaWikiServices::resetGlobalInstance(
new GlobalVarConfig(),
'quick' );
610 MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
624define(
'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
626MWExceptionHandler::installHandler();
629foreach ( [
'wgArticlePath',
'wgVariantArticlePath' ] as $varName ) {
630 if ( $$varName && !
preg_match(
'/^(https?:\/\/|\/)/', $$varName ) ) {
632 "If you use a relative URL for \$$varName, it must start " .
633 'with a slash (<code>/</code>).<br><br>See ' .
634 "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
635 "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
649 wfWarn(
'$wgServerName should be derived from $wgCanonicalServer, '
650 .
'not customized. Overwriting $wgServerName.' );
670 wfWarn(
'Secure login was enabled on a server that only supports '
671 .
'HTTP or HTTPS. Disabling secure login.' );
683if ( !
isset( $wgDisableCounters ) ) {
684 $wgDisableCounters =
true;
692 'class' => WANObjectCache::class,
734 time() - ChronologyProtector::POSITION_COOKIE_TTL
736MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->setRequestInfo( [
738 'UserAgent' =>
$wgRequest->getHeader(
'User-Agent' ),
739 'ChronologyProtection' =>
$wgRequest->getHeader(
'ChronologyProtection' ),
741 'ChronologyClientId' =>
$cpPosInfo[
'clientId']
745if (
$wgRequest->getCookie(
'UseDC',
'' ) ===
'master' ) {
749 MediaWikiServices::getInstance()->getMainWANObjectCache()->useInterimHoldOffCaching(
false );
754 wfDebug(
"\n\nStart command line script $self\n" );
756 $debug =
"\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
759 $debug .=
"HTTP HEADERS:\n";
762 $debug .=
"$name: $value\n";
768$wgMemc = ObjectCache::getLocalClusterInstance();
779Profiler::instance()->scopedProfileOut(
$ps_misc );
782Hooks::run(
'SetupAfterCache' );
790$wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
808 if ( !defined(
'MW_NO_SESSION_HANDLER' ) ) {
809 MediaWiki\Session\PHPSessionHandler::install(
810 MediaWiki\Session\SessionManager::singleton()
816 $session = MediaWiki\Session\SessionManager::getGlobalSession();
817 }
catch ( OverflowException $ex ) {
818 if (
isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
822 foreach ( $ex->sessionInfos as $info ) {
823 $list[] = $info->getProvider()->describe(
$wgContLang );
827 Message::newFromKey(
'sessionmanager-tie', $list )->inLanguage(
$wgContLang )->
plain()
835 if ( $session->isPersistent() ) {
840 if (
MediaWiki\Session\PHPSessionHandler::isEnabled() &&
841 ( $session->isPersistent() || $session->shouldRememberUser() ) &&
842 session_id() !== $session->getId()
846 wfDebugLog(
'session',
'PHP session {old_id} was already started, changing to {new_id}',
'all', [
848 'new_id' => $session->getId(),
860 if ( !defined(
'MW_NO_SESSION_HANDLER' ) ) {
861 MediaWiki\Session\PHPSessionHandler::install(
862 MediaWiki\Session\SessionManager::singleton()
880$wgOut = RequestContext::getMain()->getOutput();
887 return MediaWikiServices::getInstance()->getParser();
895Profiler::instance()->scopedProfileOut(
$ps_globals );
909 $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
911 $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser(
913 MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
916 \MediaWiki\Logger\LoggerFactory::getInstance(
'authevents' )->info(
'Autocreation attempt', [
917 'event' =>
'autocreate',
922 unset( $sessionUser );
932Profiler::instance()->scopedProfileOut(
$ps_setup );
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
$wgRightsIcon
Override for copyright metadata.
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
string $wgSharedUploadDirectory
Shortcut for the 'directory' setting of $wgForeignFileRepos.
$wgUsePathInfo
Whether to support URLs like index.php/Page_title These often break when PHP is set up in CGI mode.
$wgLanguageCode
Site language code.
$wgEmergencyContact
Site admin email address.
$wgDBprefix
Table name prefix.
$wgDBuser
Database username.
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
bool $wgCacheSharedUploads
Shortcut for the ForeignDBRepo 'hasSharedCache' setting in $wgForeignFileRepos.
bool string $wgSharedUploadDBname
Shortcut for the ForeignDBRepo 'dbName' setting in $wgForeignFileRepos.
$wgScript
The URL path to index.php.
$wgUseInstantCommons
Use Wikimedia Commons as a foreign file repository.
bool $wgHashedSharedUploadDirectory
Shortcut for the 'hashLevels' setting of $wgForeignFileRepos.
$wgCacheDirectory
Directory for caching data in the local filesystem.
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
$wgRightsUrl
Set this to specify an external URL containing details about the content license used on your wiki.
$wgSessionName
Override to customise the session name.
$wgLocalInterwiki
The interwiki prefix of the current wiki, or false if it doesn't have one.
$wgPasswordPolicy
Password policy for the wiki.
$wgLogNames
Lists the message key string for each log type.
$wgHashedUploadDirectory
Set this to false if you do not want MediaWiki to divide your images directory into many subdirectori...
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
$wgLocalStylePath
The URL path of the skins directory.
$wgThumbnailScriptPath
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating t...
$wgExtraNamespaces
Additional namespaces.
$wgTmpDirectory
The local filesystem path to a temporary directory.
bool $wgUseSharedUploads
Shortcut for adding an entry to $wgForeignFileRepos.
string $wgSharedUploadDBprefix
Shortcut for the ForeignDBRepo 'tablePrefix' setting in $wgForeignFileRepos.
$wgDBmwschema
Mediawiki schema; this should be alphanumeric and not contain spaces nor hyphens.
$wgNoReplyAddress
Reply-To address for e-mail notifications.
$wgDBerrorLogTZ
Timezone to use in the error log.
$wgUploadDirectory
The filesystem path of the images directory.
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
$wgMaximalPasswordLength
Specifies the maximal length of a user password (T64685).
$wgSitename
Name of the site.
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode.
$wgResourceLoaderMaxQueryLength
If set to a positive number, ResourceLoader will not generate URLs whose query string is more than th...
$wgFileCacheDirectory
Directory where the cached page will be saved.
$wgRightsText
If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link.
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
$wgPageCreationLog
Maintain a log of page creations at Special:Log/create?
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
$wgProfileOnly
Don't put non-profiling info into log file.
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
$wgUploadPath
The URL path for the images directory.
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
$wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
$wgUseSquid
Enable/disable CDN.
$wgShellLocale
Locale for LC_ALL, to provide a known environment for locale-sensitive operations.
$wgSecureLogin
This is to let user authenticate using https when they come from http.
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go.
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
$wgUploadBaseUrl
If set, this URL is added to the start of $wgUploadPath to form a complete upload URL.
bool $wgFetchCommonsDescriptions
Shortcut for the 'fetchDescription' setting of $wgForeignFileRepos.
string $wgSharedThumbnailScriptPath
Shortcut for the 'thumbScriptUrl' setting of $wgForeignFileRepos.
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
$wgLocalFileRepo
File repository structures.
$wgDeletedDirectory
What directory to place deleted uploads in.
$wgScriptPath
The path we should point to.
$wgWANObjectCaches
Advanced WAN object cache configuration.
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
$wgMainStash
Main object stash type.
$wgExtensionAssetsPath
The URL path of the extensions directory.
$wgDebugToolbar
Display the new debugging toolbar.
$wgForeignFileRepos
Enable the use of files from one or more other wikis.
$wgRepositoryBaseUrl
Shortcut for the 'descBaseUrl' setting of $wgForeignFileRepos.
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type.
$wgDebugLogGroups
Map of string log group names to log destinations.
$wgSharedDB
Shared database for multiple wikis.
$wgSessionCacheType
The cache type for storing session data.
$wgDebugDumpSql
Write SQL queries to the debug log.
$wgDBserver
Database host name or IP address.
$wgLoadScript
The URL path to load.php.
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
$wgExtraLanguageCodes
List of mappings from one language code to another.
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
$wgStylePath
The URL path of the skins directory.
$wgServer
URL of the server.
$wgRCFilterByAge
Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be store...
$wgMinimalPasswordLength
Specifies the minimal length of a user password.
$wgMetaNamespace
Name of the project namespace.
$wgLogo
The URL path of the wiki logo.
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites.
$wgDebugLogFile
Filename for debug logging.
$wgPasswordSender
Sender email address for e-mail notifications.
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
string $wgSharedUploadPath
Shortcut for the 'url' setting of $wgForeignFileRepos.
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
$wgMainWANCache
Main Wide-Area-Network cache type.
$wgDebugPrintHttpHeaders
Print HTTP headers for every request in the debug information.
$wgDBpassword
Database user's password.
$wgRCLinkDays
List of Days options to list in the Special:Recentchanges and Special:Recentchangeslinked pages.
$wgNewUserLog
Maintain a log of newusers at Special:Log/newusers?
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
wfTempDir()
Tries to get the system directory for temporary files.
wfWarn( $msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
wfIniGetBool( $setting)
Safety wrapper around ini_get() for boolean settings.
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
wfExpandUrl( $url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
wfDebugLog( $logGroup, $text, $dest='all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not.
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
wfMemoryLimit()
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
wfDeprecated( $function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
$wgGroupPermissions['sysop']['replacetext']
$wgGalleryOptions
Default parameters for the "<gallery>" tag.
if(is_array($wgExtraNamespaces)) if(count( $wgDummyLanguageCodes) !==0) $wgDummyLanguageCodes
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//' $wgVirtualRestConfig)['global']['domain']
if( $wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
if( $wgUseFileCache|| $wgUseSquid) $wgHtml5
foreach(LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
foreach([ 'wgArticlePath', 'wgVariantArticlePath'] as $varName) $ps_default2
global $wgCommandLineMode
foreach( $wgExtensionFunctions as $func) if(!defined('MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised
$wgEnotifRevealEditorAddress
if(!defined( 'MEDIAWIKI')) $wgScopeTest
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
$wgUsersNotifiedOnAllChanges
if(! $wgDBerrorLogTZ) $wgRequest
if($wgScript===false) if( $wgLoadScript===false) if($wgArticlePath===false) if(!empty( $wgActionPaths) &&!isset( $wgActionPaths['view'])) if($wgResourceBasePath===null) if( $wgStylePath===false) if($wgLocalStylePath===false) if( $wgExtensionAssetsPath===false) if($wgLogo===false) if( $wgUploadPath===false) if($wgUploadDirectory===false) if( $wgReadOnlyFile===false) if($wgFileCacheDirectory===false) if( $wgDeletedDirectory===false) if($wgGitInfoCacheDirectory===false &&$wgCacheDirectory !==false) if( $wgRightsIcon) if(isset($wgFooterIcons $wgNamespaceProtection[ 'copyright'][ 'copyright']) &&$wgFooterIcons[ 'copyright'][ 'copyright']===[]) if(isset( $wgFooterIcons['poweredby']) &&isset( $wgFooterIcons['poweredby']['mediawiki']) && $wgFooterIcons['poweredby']['mediawiki']['src']===null)[NS_MEDIAWIKI]
Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgName...
if($wgLocalInterwiki) if( $wgSharedPrefix===false) if($wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix
if( $wgServerName !==false) $wgServerName
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
if( $wgCanonicalServer===false) $serverParts
if( $wgSkipSkin) $wgSkipSkins[]
if($wgMetaNamespace===false) if( $wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
Exception class which takes an HTML error message, and does not produce a backtrace.
Accesses configuration settings from $GLOBALS.
Show an error that looks like an HTTP server error.
Functions to get cache objects.
static schedulePingback()
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send...
static instance()
Singleton.
static getMain()
Get the RequestContext object associated with the main request.
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Stub object for the user language.
static getMaxUploadSize( $forType=null)
Get the MediaWiki maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
static getMaxPhpUploadSize()
Get the PHP maximum uploaded file size, based on ini settings.
static isValidUserName( $name)
Is the input a valid username?
static detectProtocol()
Detect the protocol from $_SERVER.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
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
CACHE_MEMCACHED $wgMainCacheType