32 if ( !defined(
'MEDIAWIKI' ) ) {
44 echo
"Error, Setup.php must be included from the file scope, after DefaultSettings.php\n";
48 mb_internal_encoding(
'UTF-8' );
89 $wgLogo =
"$wgResourceBasePath/resources/assets/wiki.png";
119 "{$wgStylePath}/common/images/",
120 "{$wgResourceBasePath}/resources/assets/licenses/",
142 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_88x31.png";
144 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_132x47.png 1.5x, " .
145 "$wgResourceBasePath/resources/assets/poweredby_mediawiki_176x62.png 2x";
169 'name' =>
'fsLockManager',
170 'class' =>
'FSLockManager',
171 'lockDirectory' =>
"{$wgUploadDirectory}/lockdir",
174 'name' =>
'nullLockManager',
175 'class' =>
'NullLockManager',
183 'class' =>
'LocalRepo',
187 'scriptExtension' =>
'.php',
202 'class' =>
'ForeignDBRepo',
222 'class' =>
'FileRepo',
236 'class' =>
'ForeignAPIRepo',
237 'name' =>
'wikimediacommons',
238 'apibase' =>
'https://commons.wikimedia.org/w/api.php',
239 'url' =>
'https://upload.wikimedia.org/wikipedia/commons',
240 'thumbUrl' =>
'https://upload.wikimedia.org/wikipedia/commons/thumb',
242 'transformVia404' =>
true,
243 'fetchDescription' =>
true,
244 'descriptionCacheExpiry' => 43200,
245 'apiThumbCacheExpiry' => 86400,
256 if ( !isset( $repo[
'directory'] ) && $repo[
'class'] ===
'ForeignAPIRepo' ) {
259 if ( !isset( $repo[
'backend'] ) ) {
260 $repo[
'backend'] = $repo[
'name'] .
'-backend';
354 $suhosinMaxValueLength = (int)ini_get(
'suhosin.get.max_value_length' );
355 if ( $suhosinMaxValueLength > 0 && $suhosinMaxValueLength < 2000 ) {
360 unset( $suhosinMaxValueLength );
370 ini_get(
'post_max_size' ) ?: ini_get(
'hhvm.server.max_post_size' ),
372 ) ?: PHP_INT_MAX ) - 1024
424 MediaWiki\suppressWarnings();
426 MediaWiki\restoreWarnings();
458 'clientlogin' =>
'ApiDisabled',
459 'createaccount' =>
'ApiCreateAccount',
460 'linkaccount' =>
'ApiDisabled',
461 'unlinkaccount' =>
'ApiDisabled',
462 'changeauthenticationdata' =>
'ApiDisabled',
463 'removeauthenticationdata' =>
'ApiDisabled',
464 'resetpassword' =>
'ApiDisabled',
467 'authmanagerinfo' =>
'ApiQueryDisabled',
482 wfDeprecated(
'$wgSessionsInObjectCache = false',
'1.27' );
489 "Session data will be stored in \"$cacheType\" cache with " .
490 "expiry $wgObjectCacheSessionExpiry seconds"
501 if ( defined(
'MW_NO_SESSION' ) ) {
516 if ( !class_exists(
'AutoLoader' ) ) {
517 require_once
"$IP/includes/AutoLoader.php";
522 MediaWikiServices::resetGlobalInstance(
new GlobalVarConfig(),
'quick' );
526 define(
'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
529 if ( !$wgCommandLineMode ) {
530 header_register_callback(
function () {
532 foreach ( headers_list()
as $header ) {
534 $headers[strtolower( trim(
$name ) )][] = trim(
$value );
537 if ( isset( $headers[
'set-cookie'] ) ) {
538 $cacheControl = isset( $headers[
'cache-control'] )
539 ? implode(
', ', $headers[
'cache-control'] )
542 if ( !preg_match(
'/(?:^|,)\s*(?:private|no-cache|no-store)\s*(?:$|,)/i', $cacheControl ) ) {
543 header(
'Expires: Thu, 01 Jan 1970 00:00:00 GMT' );
544 header(
'Cache-Control: private, max-age=0, s-maxage=0' );
546 'Cookies set on {url} with Cache-Control "{cache-control}"', [
548 'cookies' => $headers[
'set-cookie'],
549 'cache-control' => $cacheControl ?:
'<not set>',
559 require_once
"$IP/includes/compat/normal/UtfNormalUtil.php";
564 foreach ( [
'wgArticlePath',
'wgVariantArticlePath' ]
as $varName ) {
565 if ( $$varName && !preg_match(
'/^(https?:\/\/|\/)/', $$varName ) ) {
567 "If you use a relative URL for \$$varName, it must start " .
568 'with a slash (<code>/</code>).<br><br>See ' .
569 "<a href=\"https://www.mediawiki.org/wiki/Manual:\$$varName\">" .
570 "https://www.mediawiki.org/wiki/Manual:\$$varName</a>."
586 wfWarn(
'$wgServerName should be derived from $wgCanonicalServer, '
587 .
'not customized. Overwriting $wgServerName.' );
607 wfWarn(
'Secure login was enabled on a server that only supports '
608 .
'HTTP or HTTPS. Disabling secure login.' );
620 if ( !isset( $wgDisableCounters ) ) {
621 $wgDisableCounters =
true;
629 'class' =>
'WANObjectCache',
631 'channels' => [
'purge' =>
'wancache-main-default-purge' ]
648 MediaWiki\suppressWarnings();
650 MediaWiki\restoreWarnings();
666 if ( $wgCommandLineMode ) {
667 wfDebug(
"\n\nStart command line script $self\n" );
669 $debug =
"\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
672 $debug .=
"HTTP HEADERS:\n";
675 $debug .=
"$name: $value\n";
689 'cluster: ' . get_class(
$wgMemc ) .
721 new MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider( [
722 'authoritative' =>
false,
725 new MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider( [
726 'authoritative' =>
true,
728 ],
'$wgAuth is ' . get_class(
$wgAuth ) );
738 if ( !defined(
'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
746 if ( !defined(
'MW_NO_SESSION_HANDLER' ) ) {
748 MediaWiki\Session\SessionManager::singleton()
755 }
catch ( OverflowException $ex ) {
756 if ( isset( $ex->sessionInfos ) && count( $ex->sessionInfos ) >= 2 ) {
760 foreach ( $ex->sessionInfos
as $info ) {
761 $list[] = $info->getProvider()->describe(
$wgContLang );
773 if ( $session->isPersistent() ) {
778 if (
MediaWiki\Session\PHPSessionHandler::isEnabled() &&
779 ( $session->isPersistent() || $session->shouldRememberUser() )
782 session_id( $session->getId() );
783 MediaWiki\quietCall(
'session_start' );
790 if ( !defined(
'MW_NO_SESSION_HANDLER' ) ) {
792 MediaWiki\Session\SessionManager::singleton()
832 if ( is_object( $func ) && $func instanceof Closure ) {
833 $profName =
$fname .
'-extensions-closure';
834 } elseif ( is_array( $func ) ) {
835 if ( is_object( $func[0] ) ) {
836 $profName =
$fname .
'-extensions-' . get_class( $func[0] ) .
'::' . $func[1];
838 $profName =
$fname .
'-extensions-' . implode(
'::', $func );
841 $profName =
$fname .
'-extensions-' . strval( $func );
845 call_user_func( $func );
851 if ( !defined(
'MW_NO_SESSION' ) && !$wgCommandLineMode ) {
860 MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION,
866 'event' =>
'autocreate',
871 unset( $sessionUser );
874 if ( !$wgCommandLineMode ) {
878 wfDebug(
"Fully initialised\n" );
$wgUseInstantCommons
Use Commons as a remote file repository.
$wgFooterIcons
Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code You can ad...
$wgNewUserLog
Maintain a log of newusers at Log/newusers?
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
$wgMainStash
Main object stash type.
$wgHashedSharedUploadDirectory
Set the following to false especially if you have a set of files that need to be accessible by all wi...
$wgCanonicalNamespaceNames
Definitions of the NS_ constants are in Defines.php.
$wgScript
The URL path to index.php.
$wgRightsUrl
Set this to specify an external URL containing details about the content license used on your wiki...
$wgDBerrorLogTZ
Timezone to use in the error log.
$wgVersion
MediaWiki version number.
$wgSitename
Name of the site.
$wgUsersNotifiedOnAllChanges
$wgDebugLogGroups
Map of string log group names to log destinations.
wfShorthandToInteger($string= '', $default=-1)
Converts shorthand byte notation to integer form.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
if($wgMetaNamespace===false) if($wgResourceLoaderMaxQueryLength===false) $wgMinUploadChunkSize
static instance()
Singleton.
$wgDBpassword
Database user's password.
$wgSharedUploadDBname
DB name with metadata about shared directory.
$wgDebugToolbar
Display the new debugging toolbar.
if($wgInvalidateCacheOnLocalSettingsChange) if($wgNewUserLog) if($wgPageLanguageUseDB) if($wgCookieSecure=== 'detect') if($wgProfileOnly) if($wgDisableAuthManager) if($wgMinimalPasswordLength!==false) if($wgMaximalPasswordLength!==false) if(!$wgSessionsInObjectCache &&!$wgSessionsInMemcached) $wgSessionsInObjectCache
$wgThumbnailScriptPath
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating t...
$wgRepositoryBaseUrl
Base URL for a repository wiki.
static getInstance($id)
Get a cached instance of the specified type of cache object.
$wgLocalFileRepo
File repository structures.
Authentication plugin interface.
$wgSecureLogin
This is to let user authenticate using https when they come from http.
$wgDBmwschema
Mediawiki schema.
$wgMetaNamespace
Name of the project namespace.
$wgDBserver
Database host name or IP address.
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
if($wgUseFileCache||$wgUseSquid) $wgHtml5
$wgDBuser
Database username.
$wgMainWANCache
Main Wide-Area-Network cache type.
$wgSharedUploadDirectory
Path on the file system where shared uploads can be found.
$wgAuth $wgAuth
Authentication plugin.
$wgCookieSecure
Whether the "secure" flag should be set on the cookie.
$wgTmpDirectory
The local filesystem path to a temporary directory.
when a variable name is used in a it is silently declared as a new local masking the global
wfExpandUrl($url, $defaultProto=PROTO_CURRENT)
Expand a potentially local URL to a fully-qualified URL.
$wgAPIModules
API module extensions.
$wgWANObjectCaches
Advanced WAN object cache configuration.
$wgLogNames
Lists the message key string for each log type.
wfGetMessageCacheStorage()
Get the cache object used by the message cache.
$wgDebugLogFile
Filename for debug logging.
$wgGenerateThumbnailOnParse
Allow thumbnail rendering on page view.
$wgRCMaxAge
Recentchanges items are periodically purged; entries older than this many seconds will go...
$wgEnableEmail
Set to true to enable the e-mail basic features: Password reminders, etc.
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfGetParserCacheStorage()
Get the cache object used by the parser cache.
static getMaxUploadSize($forType=null)
Get the MediaWiki maximum uploaded file size for given type of upload, based on $wgMaxUploadSize.
$wgCacheDirectory
Directory for caching data in the local filesystem.
$wgDebugDumpSql
Write SQL queries to the debug log.
$wgInvalidateCacheOnLocalSettingsChange
Invalidate various caches when LocalSettings.php changes.
$wgGroupPermissions
Permission keys given to users in each group.
$wgUseSquid
Enable/disable CDN.
Show an error that looks like an HTTP server error.
static isValidUserName($name)
Is the input a valid username?
if(is_array($wgExtraNamespaces)) $wgContLanguageCode
$wgLanguageCode
Site language code.
Accesses configuration settings from $GLOBALS.
wfDebugLog($logGroup, $text, $dest= 'all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
global $wgCommandLineMode
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...
$wgStylePath
The URL path of the skins directory.
$wgPasswordPolicy
Password policy for local wiki users.
$wgParserCacheType
The cache type for storing article HTML.
wfTempDir()
Tries to get the system directory for temporary files.
static getMain()
Static methods.
$wgUseFileCache
This will cache static pages for non-logged-in users to reduce database traffic on public sites...
$wgDeletedDirectory
What directory to place deleted uploads in.
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.
$wgLocalInterwikis
Array for multiple $wgLocalInterwiki values, in case there are several interwiki prefixes that point ...
$wgSharedUploadPath
Full path on the web server where shared uploads can be found.
$wgEnotifRevealEditorAddress
$wgUsePathInfo
Whether to support URLs like index.php/Page_title These often break when PHP is set up in CGI mode...
$wgResourceBasePath
The default 'remoteBasePath' value for instances of ResourceLoaderFileModule.
$wgMaximalPasswordLength
Specifies the maximal length of a user password (T64685).
CACHE_MEMCACHED $wgMainCacheType
wfDeprecated($function, $version=false, $component=false, $callerOffset=2)
Throws a warning that $function is deprecated.
$wgProfileOnly
Don't put non-profiling info into log file.
$wgSharedDB
Shared database for multiple wikis.
$wgEnableParserCache
Kept for extension compatibility; see $wgParserCacheType.
Class to implement stub globals, which are globals that delay loading the their associated module cod...
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
$wgRightsText
If either $wgRightsUrl or $wgRightsPage is specified then this variable gives the text for the link...
static schedulePingback()
Schedule a deferred callable that will check if a pingback should be sent and (if so) proceed to send...
$wgSessionName
Override to customise the session name.
static detectProtocol()
Detect the protocol from $_SERVER.
$wgLocaltimezone
Fake out the timezone that the server thinks it's in.
$wgRCFilterByAge
Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be store...
$wgLockManagers[]
Initialise $wgLockManagers to include basic FS version.
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
$wgSessionsInMemcached
Deprecated alias for $wgSessionsInObjectCache.
$wgLogActionsHandlers
The same as above, but here values are names of classes, not messages.
$wgPasswordSender
Sender email address for e-mail notifications.
if($wgServerName!==false) $wgServerName
Exception class which takes an HTML error message, and does not produce a backtrace.
bool $wgPageLanguageUseDB
Enable page language feature Allows setting page language in database.
$wgSharedUploadDBprefix
Optional table prefix used in database.
static newFromKey($key)
Factory function that is just wrapper for the real constructor.
$wgSessionCacheType
The cache type for storing session data.
$wgUploadPath
The URL path for the images directory.
$wgEmergencyContact
Site admin email address.
$wgExtraNamespaces
Additional namespaces.
static getGlobalRequestURL()
Return the path and query string portion of the main request URI.
$wgReadOnlyFile
If this lock file exists (size > 0), the wiki will be forced into read-only mode. ...
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
if(!is_object($wgAuth)) if(!$wgDisableAuthManager &&$wgAuth &&!$wgAuth instanceof MediaWiki\Auth\AuthManagerAuthPlugin) $ps_session
if($wgCanonicalServer===false) $serverParts
if($wgLocalInterwiki) if($wgSharedPrefix===false) if($wgSharedSchema===false) if(!$wgCookiePrefix) $wgCookiePrefix
$wgLocalStylePath
The URL path of the skins directory.
$wgSharedThumbnailScriptPath
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
$wgMinimalPasswordLength
Specifies the minimal length of a user password.
static installHandler()
Install handlers with PHP.
if($wgSkipSkin) $wgSkipSkins[]
$wgNamespaceAliases['Image']
The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".
$wgScriptPath
The path we should point to.
$wgLocalInterwiki
The interwiki prefix of the current wiki, or false if it doesn't have one.
$wgCacheSharedUploads
Cache shared metadata in memcached.
Stub object for the user language.
wfGetMainCache()
Get the main cache object.
$wgExtensionAssetsPath
The URL path of the extensions directory.
if(!$wgEmergencyContact) if(!$wgPasswordSender) if(!$wgNoReplyAddress) if($wgSecureLogin &&substr($wgServer, 0, 2)!== '//') $wgVirtualRestConfig['global']['domain']
$wgDisableAuthManager
Disable AuthManager.
$wgDBprefix
Table name prefix.
$wgAllowHTMLEmail
For parts of the system that have been updated to provide HTML email content, send both text and HTML...
wfMemoryLimit()
Set PHP's memory limit to the larger of php.ini or $wgMemoryLimit.
$wgLogHeaders
Lists the message key string for descriptive text to be shown at the top of each log type...
$wgCanonicalServer
Canonical URL of the server, to use in IRC feeds and notification e-mails.
$wgHashedUploadDirectory
Set this to false if you do not want MediaWiki to divide your images directory into many subdirectori...
$wgAPIMetaModules
API Query meta module extensions.
$wgLogo
The URL path of the wiki logo.
$wgLocalTZoffset
Set an offset from UTC in minutes to use for the default timezone setting for anonymous users and new...
static getMaxPhpUploadSize()
Get the PHP maximum uploaded file size, based on ini settings.
$wgServer
URL of the server.
$wgGitInfoCacheDirectory
Directory where GitInfo will look for pre-computed cache files.
$wgFetchCommonsDescriptions
Fetch commons image description pages and display them on the local wiki?
$wgExtensionFunctions
A list of callback functions which are called once MediaWiki is fully initialised.
$wgUploadBaseUrl
If set, this URL is added to the start of $wgUploadPath to form a complete upload URL...
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
$wgRCLinkDays
List of Days options to list in the Special:Recentchanges and Special:Recentchangeslinked pages...
$wgLogTypes
The logging system has two levels: an event type, which describes the general category and can be vie...
$wgResourceLoaderMaxQueryLength
If set to a positive number, ResourceLoader will not generate URLs whose query string is more than th...
string $wgPHPSessionHandling
Whether to use PHP session handling ($_SESSION and session_*() functions)
wfParseUrl($url)
parse_url() work-alike, but non-broken.
static factory($code)
Get a cached or new language object for a given language code.
$wgDebugPrintHttpHeaders
Print HTTP headers for every request in the debug information.
$wgRightsIcon
Override for copyright metadata.
$wgFileBlacklist
Files with these extensions will never be allowed as uploads.
$wgLoadScript
The URL path to load.php.
$wgNoReplyAddress
Reply-To address for e-mail notifications.
$wgCacheEpoch
Set this to current time to invalidate all prior cached pages.
$wgFileCacheDirectory
Directory where the cached page will be saved.
static init()
Enabled the debugger and load resource module.
$wgUseSharedUploads
If you operate multiple wikis, you can define a shared upload path here.
if(is_null($wgLocalTZoffset)) if(!$wgDBerrorLogTZ) $wgRequest
if($wgRCFilterByAge) $wgDefaultUserOptions['rcdays']
$wgUploadDirectory
The filesystem path of the images directory.
Allows to change the fields on the form that will be generated $name