MediaWiki  1.34.0
Setup.php File Reference

Include most things that are needed to make MediaWiki work. More...

Go to the source code of this file.

Variables

 $cpPosInfo
 
 $debug = "HTTP HEADERS:\n"
 
 $messageMemc = wfGetMessageCacheStorage()
 
 $rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 )
 
if( $wgServer===false) foreach([ 'wgArticlePath', 'wgVariantArticlePath'] as $varName) if( $wgCanonicalServer===false) $serverParts = wfParseUrl( $wgCanonicalServer )
 
 $wgCanonicalNamespaceNames = NamespaceInfo::$canonicalNames
 Definitions of the NS_ constants are in Defines.php. More...
 
 $wgContLang = MediaWikiServices::getInstance()->getContentLanguage()
 
foreach(LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode = $wgLanguageCode
 
if( $wgLocalInterwiki) if( $wgSharedPrefix===false) if( $wgSharedSchema===false) if(! $wgCookiePrefix) $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' )
 
 $wgDefaultUserOptions ['rcdays']
 
if(is_null( $wgLocalTZoffset)) $wgDefaultUserOptions ['timecorrection'] = "System|$wgLocalTZoffset"
 
 $wgDefaultUserOptions ['watchlistdays']
 
if(is_array( $wgExtraNamespaces)) if(count( $wgDummyLanguageCodes) !==0) $wgDummyLanguageCodes
 
 $wgEmailAuthentication = false
 
 $wgEnableUserEmail = false
 
 $wgEnotifFromEditor = false
 
 $wgEnotifImpersonal = false
 
 $wgEnotifMaxRecips = 0
 
 $wgEnotifMinorEdits = false
 
 $wgEnotifRevealEditorAddress = false
 
 $wgEnotifUseRealName = false
 
 $wgEnotifUserTalk = false
 
 $wgEnotifWatchlist = false
 
 $wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) )
 
foreach( $wgExtensionFunctions as $func) if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) if(! $wgCommandLineMode) $wgFullyInitialised = true
 
 $wgGalleryOptions
 Default parameters for the "<gallery>" tag. More...
 
 $wgInitialSessionId = null
 
 $wgLang = new StubUserLang
 
 $wgLockManagers []
 Initialise $wgLockManagers to include basic FS version. More...
 
 $wgMemc = ObjectCache::getLocalClusterInstance()
 
if(isset( $wgSysopEmailBans) && $wgSysopEmailBans===false) if( $wgMetaNamespace===false) $wgMinUploadChunkSize
 
 $wgNamespaceAliases ['Image'] = NS_FILE
 The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk". More...
 
 $wgNamespaceAliases ['Image_talk'] = NS_FILE_TALK
 
if( $wgScript===false) if( $wgLoadScript===false) if( $wgRestPath===false) if( $wgArticlePath===false) if( $wgResourceBasePath===null) if( $wgStylePath===false) if( $wgLocalStylePath===false) if( $wgExtensionAssetsPath===false) if( $wgLogo===false) if( $wgUploadPath===false) if( $wgUploadDirectory===false) if( $wgReadOnlyFile===false) if( $wgFileCacheDirectory===false) if( $wgDeletedDirectory===false) if( $wgGitInfoCacheDirectory===false && $wgCacheDirectory !==false) if( $wgRightsIcon) if(isset( $wgFooterIcons['copyright']['copyright']) && $wgFooterIcons['copyright']['copyright']===[]) if(isset( $wgFooterIcons['poweredby']) &&isset( $wgFooterIcons['poweredby']['mediawiki']) && $wgFooterIcons['poweredby']['mediawiki']['src']===null) $wgNamespaceProtection [NS_MEDIAWIKI] = 'editinterface'
 Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure. More...
 
 $wgOut = RequestContext::getMain()->getOutput()
 
 $wgParser
 
if(! $wgDBerrorLogTZ) $wgRequest = RequestContext::getMain()->getRequest()
 
if(!defined( 'MEDIAWIKI')) $wgScopeTest = 'MediaWiki Setup.php scope test'
 This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined. More...
 
if( $wgServerName !==false) $wgServerName = $serverParts['host']
 
if( $wgSkipSkin) $wgSkipSkins [] = 'fallback'
 
 $wgTitle = null
 
 $wgUseEnotif = false
 
 $wgUserEmailUseReplyTo = false
 
 $wgUsersNotifiedOnAllChanges = []
 
if(! $wgEmergencyContact) if(! $wgPasswordSender) if(! $wgNoReplyAddress) if( $wgSecureLogin &&substr( $wgServer, 0, 2) !=='//') $wgVirtualRestConfig ['global']['domain'] = $wgCanonicalServer
 
if(defined( 'MW_CONFIG_CALLBACK')) else
 Load LocalSettings.php. More...
 
if(ini_get( 'mbstring.func_overload')) if (!defined('MW_ENTRY_POINT'))
 Pre-config setup: Before loading LocalSettings.php. More...
 
const MW_SERVICE_BOOTSTRAP_COMPLETE 1
 

Detailed Description

Include most things that are needed to make MediaWiki work.

This file is included by WebStart.php and doMaintenance.php so that both web and maintenance scripts share a final set up phase to include necessary files and create global object variables.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file Setup.php.

Variable Documentation

◆ $cpPosInfo

$cpPosInfo
Initial value:
= LBFactory::getCPInfoFromCookieValue(
$wgRequest->getCookie( 'cpPosIndex', '' ),
time() - ChronologyProtector::POSITION_COOKIE_TTL
)

Definition at line 754 of file Setup.php.

◆ $debug

◆ $messageMemc

$messageMemc = wfGetMessageCacheStorage()

Definition at line 792 of file Setup.php.

Referenced by TitleBlacklist\getHttp(), and BaseBlacklist\getHttpText().

◆ $rcMaxAgeDays

$rcMaxAgeDays = $wgRCMaxAge / ( 3600 * 24 )

Definition at line 370 of file Setup.php.

◆ $serverParts

if ($wgServer===false) foreach (['wgArticlePath', 'wgVariantArticlePath'] as $varName) if ($wgCanonicalServer===false) $serverParts = wfParseUrl( $wgCanonicalServer )

Definition at line 659 of file Setup.php.

◆ $wgCanonicalNamespaceNames

$wgCanonicalNamespaceNames = NamespaceInfo::$canonicalNames

Definitions of the NS_ constants are in Defines.php.

Access:\n private

Definition at line 471 of file Setup.php.

Referenced by wfInstallerMain().

◆ $wgContLang

◆ $wgContLanguageCode

foreach (LanguageCode::getNonstandardLanguageCodeMapping() as $code=> $bcp47) $wgContLanguageCode = $wgLanguageCode

Definition at line 499 of file Setup.php.

Referenced by SpecialCiteThisPage\getContentText().

◆ $wgCookiePrefix

if ($wgLocalInterwiki) if ($wgSharedPrefix===false) if ($wgSharedSchema===false) if (! $wgCookiePrefix) $wgCookiePrefix = strtr( $wgCookiePrefix, '=,; +."\'\\[', '__________' )

Definition at line 419 of file Setup.php.

◆ $wgDefaultUserOptions [1/3]

$wgDefaultUserOptions[ 'rcdays']
Initial value:
= min(
ceil( $rcMaxAgeDays )
)

Definition at line 372 of file Setup.php.

◆ $wgDefaultUserOptions [2/3]

if (is_null($wgLocalTZoffset)) $wgDefaultUserOptions[ 'timecorrection'] = "System|$wgLocalTZoffset"

Definition at line 745 of file Setup.php.

◆ $wgDefaultUserOptions [3/3]

$wgDefaultUserOptions[ 'watchlistdays']
Initial value:
= min(
$wgDefaultUserOptions['watchlistdays'],
ceil( $rcMaxAgeDays )
)

Definition at line 376 of file Setup.php.

◆ $wgDummyLanguageCodes

if (is_array($wgExtraNamespaces)) if (count($wgDummyLanguageCodes) !==0) $wgDummyLanguageCodes
Initial value:
= [
'qqq' => 'qqq',
'qqx' => 'qqx',
Todo:
UGLY UGLY

Definition at line 483 of file Setup.php.

◆ $wgEmailAuthentication

$wgEmailAuthentication = false

Definition at line 427 of file Setup.php.

◆ $wgEnableUserEmail

$wgEnableUserEmail = false

Definition at line 428 of file Setup.php.

◆ $wgEnotifFromEditor

$wgEnotifFromEditor = false

Definition at line 429 of file Setup.php.

◆ $wgEnotifImpersonal

$wgEnotifImpersonal = false

Definition at line 430 of file Setup.php.

◆ $wgEnotifMaxRecips

$wgEnotifMaxRecips = 0

Definition at line 431 of file Setup.php.

◆ $wgEnotifMinorEdits

$wgEnotifMinorEdits = false

Definition at line 432 of file Setup.php.

◆ $wgEnotifRevealEditorAddress

$wgEnotifRevealEditorAddress = false

Definition at line 433 of file Setup.php.

◆ $wgEnotifUseRealName

$wgEnotifUseRealName = false

Definition at line 434 of file Setup.php.

◆ $wgEnotifUserTalk

$wgEnotifUserTalk = false

Definition at line 435 of file Setup.php.

◆ $wgEnotifWatchlist

$wgEnotifWatchlist = false

Definition at line 436 of file Setup.php.

◆ $wgFileExtensions

$wgFileExtensions = array_values( array_diff( $wgFileExtensions, $wgFileBlacklist ) )

Definition at line 554 of file Setup.php.

◆ $wgFullyInitialised

foreach ($wgExtensionFunctions as $func) if (!defined('MW_NO_SESSION') &&! $wgCommandLineMode) if (! $wgCommandLineMode) $wgFullyInitialised = true

Definition at line 932 of file Setup.php.

Referenced by User\clearInstanceCache(), User\isSafeToLoad(), and User\load().

◆ $wgGalleryOptions

$wgGalleryOptions
Initial value:
= [
'imagesPerRow' => 0,
'imageWidth' => 120,
'imageHeight' => 120,
'captionLength' => true,
'showBytes' => true,
'showDimensions' => true,
'mode' => 'traditional',
]

Default parameters for the "<gallery>" tag.

See also
DefaultSettings.php for description of the fields.

Definition at line 274 of file Setup.php.

◆ $wgInitialSessionId

$wgInitialSessionId = null

Definition at line 810 of file Setup.php.

Referenced by LoginSignupSpecialPage\hasSessionCookie().

◆ $wgLang

Language $wgLang = new StubUserLang

Definition at line 881 of file Setup.php.

Referenced by PermissionsError\__construct(), ApiMain\__construct(), ParserOptions\__construct(), LogPage\actionText(), SpecialEditWatchlist\buildTools(), MediaWiki\Special\SpecialPageFactory\capturePath(), MediaWiki\Permissions\PermissionManager\checkActionPermissions(), Installer\envCheckDB(), WebInstallerLanguage\execute(), UpdateMediaWiki\execute(), LocalFileRestoreBatch\execute(), SpecialReplaceText\extractContext(), StubUserLang\findVariantLink(), Linker\formatAutocomments(), FeedUtils\formatDiffRow(), Scribunto_LuaStandaloneEngine\formatLimitData(), Scribunto_LuaSandboxEngine\formatLimitData(), SpecialVersion\getCopyrightAndAuthorList(), User\getDatePreference(), ForeignDBFile\getDescriptionText(), File\getDescriptionText(), MediaHandler\getGeneralShortDesc(), WebInstallerOutput\getLanguage(), PNGHandler\getLongDesc(), GIFHandler\getLongDesc(), ImageHandler\getLongDesc(), SvgHandler\getLongDesc(), ContentHandler\getPageLanguage(), Title\getPageLanguage(), Title\getPageViewLanguage(), EditPage\getPreviewLimitReport(), ImageHandler\getShortDesc(), SpecialVersion\getVersionLinkedGit(), Xml\monthSelector(), User\newFatalPermissionDeniedStatus(), SpecialReplaceText\pageListForm(), FileDeleteForm\prepareMessage(), User\sendConfirmationMail(), LoginSignupSpecialPage\setSessionUserForCurrentRequest(), WebInstaller\setupLanguage(), ForeignAPIFile\transform(), MWException\useMessageCache(), Linker\userToolLinks(), wfGetLangObj(), and wfInstallerMain().

◆ $wgLockManagers

$wgLockManagers[]
Initial value:
= [
'name' => 'fsLockManager',
'class' => FSLockManager::class,
'lockDirectory' => "{$wgUploadDirectory}/lockdir",
]

Initialise $wgLockManagers to include basic FS version.

Definition at line 260 of file Setup.php.

◆ $wgMemc

◆ $wgMinUploadChunkSize

if (isset($wgSysopEmailBans) &&$wgSysopEmailBans===false) if ($wgMetaNamespace===false) $wgMinUploadChunkSize
Initial value:
= min(
UploadBase::getMaxUploadSize( 'file' ),
UploadBase::getMaxPhpUploadSize(),
ini_get( 'post_max_size' ) ?: ini_get( 'hhvm.server.max_post_size' ),
PHP_INT_MAX
) ?: PHP_INT_MAX ) - 1024
)

Definition at line 457 of file Setup.php.

◆ $wgNamespaceAliases [1/2]

$wgNamespaceAliases[ 'Image'] = NS_FILE

The canonical names of namespaces 6 and 7 are, as of v1.14, "File" and "File_talk".

The old names "Image" and "Image_talk" are retained as aliases for backwards compatibility.

Definition at line 254 of file Setup.php.

◆ $wgNamespaceAliases [2/2]

$wgNamespaceAliases[ 'Image_talk'] = NS_FILE_TALK

Definition at line 255 of file Setup.php.

◆ $wgNamespaceProtection

if ($wgScript===false) if ($wgLoadScript===false) if ($wgRestPath===false) if ($wgArticlePath===false) if ($wgResourceBasePath===null) if ($wgStylePath===false) if ($wgLocalStylePath===false) if ($wgExtensionAssetsPath===false) if ($wgLogo===false) if ($wgUploadPath===false) if ($wgUploadDirectory===false) if ($wgReadOnlyFile===false) if ($wgFileCacheDirectory===false) if ($wgDeletedDirectory===false) if ($wgGitInfoCacheDirectory===false &&$wgCacheDirectory !==false) if ($wgRightsIcon) if (isset($wgFooterIcons[ 'copyright'][ 'copyright']) &&$wgFooterIcons[ 'copyright'][ 'copyright']===[]) if (isset($wgFooterIcons[ 'poweredby']) &&isset($wgFooterIcons[ 'poweredby'][ 'mediawiki']) &&$wgFooterIcons[ 'poweredby'][ 'mediawiki'][ 'src']===null) $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface'

Unconditional protection for NS_MEDIAWIKI since otherwise it's too easy for a sysadmin to set $wgNamespaceProtection incorrectly and leave the wiki insecure.

Note that this is the definition of editinterface and it can be granted to all users if desired.

Definition at line 247 of file Setup.php.

◆ $wgOut

◆ $wgParser

Parser $wgParser
Initial value:
= new StubObject( 'wgParser', function () {
return MediaWikiServices::getInstance()->getParser();
} )
Deprecated:
since 1.32, use MediaWikiServices::getInstance()->getParser() instead

Definition at line 892 of file Setup.php.

Referenced by ScribuntoContent\fillParserOutput(), SimpleCaptcha\findLinks(), SimpleCaptcha\loadText(), TitleBlacklistEntry\newFromString(), onContentGetParserOutput(), and ApiScribuntoConsole\runConsole().

◆ $wgRequest

◆ $wgScopeTest

if (!defined('MEDIAWIKI')) $wgScopeTest = 'MediaWiki Setup.php scope test'

This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.

Definition at line 39 of file Setup.php.

◆ $wgServerName

if ($wgServerName !==false) $wgServerName = $serverParts['host']

Definition at line 664 of file Setup.php.

◆ $wgSkipSkins

$wgSkipSkins[] = 'fallback'

Definition at line 388 of file Setup.php.

◆ $wgTitle

$wgTitle = null

Definition at line 899 of file Setup.php.

◆ $wgUseEnotif

$wgUseEnotif = false

◆ $wgUserEmailUseReplyTo

$wgUserEmailUseReplyTo = false

Definition at line 439 of file Setup.php.

◆ $wgUsersNotifiedOnAllChanges

$wgUsersNotifiedOnAllChanges = []

Definition at line 440 of file Setup.php.

◆ $wgVirtualRestConfig

if (! $wgEmergencyContact) if (! $wgPasswordSender) if (! $wgNoReplyAddress) if ($wgSecureLogin &&substr($wgServer, 0, 2) !=='//') $wgVirtualRestConfig[ 'global'][ 'domain'] = $wgCanonicalServer

Definition at line 686 of file Setup.php.

◆ else

if (!defined('MW_NO_SESSION') &&! $wgCommandLineMode) else
Initial value:
{
if ( !defined( 'MW_CONFIG_FILE' ) ) {
define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
}
require_once MW_CONFIG_FILE

Load LocalSettings.php.

Definition at line 120 of file Setup.php.

◆ if

if (ini_get('mbstring.func_overload')) if(!defined( 'MW_ENTRY_POINT'))

Pre-config setup: Before loading LocalSettings.php.

Definition at line 57 of file Setup.php.

◆ MW_SERVICE_BOOTSTRAP_COMPLETE

const MW_SERVICE_BOOTSTRAP_COMPLETE 1

Definition at line 629 of file Setup.php.

LanguageCode\getDeprecatedCodeMapping
static getDeprecatedCodeMapping()
Returns a mapping of deprecated language codes that were used in previous versions of MediaWiki to up...
Definition: LanguageCode.php:127
$wgDefaultUserOptions
$wgDefaultUserOptions['rcdays']
Definition: Setup.php:372
StubObject
Class to implement stub globals, which are globals that delay loading the their associated module cod...
Definition: StubObject.php:45
$rcMaxAgeDays
$rcMaxAgeDays
Definition: Setup.php:370
$wgMinUploadChunkSize
if(isset( $wgSysopEmailBans) && $wgSysopEmailBans===false) if( $wgMetaNamespace===false) $wgMinUploadChunkSize
Definition: Setup.php:457
wfShorthandToInteger
wfShorthandToInteger( $string='', $default=-1)
Converts shorthand byte notation to integer form.
Definition: GlobalFunctions.php:2817
$wgRequest
if(! $wgDBerrorLogTZ) $wgRequest
Definition: Setup.php:752
$wgExtraLanguageCodes
$wgExtraLanguageCodes
List of mappings from one language code to another.
Definition: DefaultSettings.php:3010