MediaWiki  master
Installer Class Reference

Base installer class. More...

Inheritance diagram for Installer:
Collaboration diagram for Installer:

Public Member Functions

 __construct ()
 Constructor, always call this from child classes. More...
 
 addInstallStep ( $callback, $findStep='BEGINNING')
 Add an installation step following the given step. More...
 
 dirIsExecutable ( $dir, $url)
 Checks if scripts located in the given directory can be executed via the given URL. More...
 
 disableLinkPopups ()
 
 doEnvironmentChecks ()
 Do initial checks of the PHP environment. More...
 
 doEnvironmentPreps ()
 
 findExtensions ( $directory='extensions')
 Find extensions or skins in a subdirectory of $IP. More...
 
 generateKeys ()
 Generate $wgSecretKey. More...
 
 getAutoExtensionHookContainer ()
 Get the hook container previously populated by includeExtensions(). More...
 
 getCompiledDBs ()
 Get a list of DBs supported by current PHP setup. More...
 
 getDBInstaller ( $type=false)
 Get an instance of DatabaseInstaller for the specified DB type. More...
 
 getDefaultSkin (array $skinNames)
 Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings, but will fall back to another if the default skin is missing and some other one is present instead. More...
 
 getFakePassword ( $realPassword)
 Get a fake password for sending back to the user in HTML. More...
 
 getParserOptions ()
 
 getVar ( $name, $default=null)
 Get an MW configuration variable, or internal installer configuration variable. More...
 
 parse ( $text, $lineStart=false)
 Convert wikitext $text to HTML. More...
 
 performInstallation ( $startCB, $endCB)
 Actually perform the installation. More...
 
 populateSiteStats (DatabaseInstaller $installer)
 Install step which adds a row to the site_stats table with appropriate initial values. More...
 
 resetMediaWikiServices (Config $installerConfig=null, $serviceOverrides=[])
 Reset the global service container and associated global state to accommodate different stages of the installation. More...
 
 restoreLinkPopups ()
 
 restoreServices ()
 Restore services that have been redefined in the early stage of installation. More...
 
 setParserLanguage ( $lang)
 ParserOptions are constructed before we determined the language, so fix it. More...
 
 setPassword ( $name, $value)
 Set a variable which stores a password, except if the new value is a fake password in which case leave it as it is. More...
 
 setVar ( $name, $value)
 Set a MW configuration variable, or internal installer configuration variable. More...
 
 showError ( $msg,... $params)
 Same as showMessage(), but for displaying errors. More...
 
 showMessage ( $msg,... $params)
 UI interface for displaying a short message The parameters are like parameters to wfMessage(). More...
 
 showStatusMessage (Status $status)
 Show a message to the installing user by using a Status object. More...
 

Static Public Member Functions

static apacheModulePresent ( $moduleName)
 Checks for presence of an Apache module. More...
 
static getDBInstallerClass ( $type)
 Get the DatabaseInstaller class name for this type. More...
 
static getDBTypes ()
 Get a list of known DB types. More...
 
static getExistingLocalSettings ()
 Determine if LocalSettings.php exists. More...
 
static getInstallerConfig (Config $baseConfig)
 Constructs a Config object that contains configuration settings that should be overwritten for the installation process. More...
 
static maybeGetWebserverPrimaryGroup ()
 On POSIX systems return the primary group of the webserver we're running under. More...
 
static overrideConfig ()
 Override the necessary bits of the config to run an installation. More...
 

Public Attributes

array $licenses
 License types. More...
 
array $rightsProfiles
 User rights profiles. More...
 
const MINIMUM_PCRE_VERSION = '7.2'
 The oldest version of PCRE we can support. More...
 

Protected Member Functions

 createMainpage (DatabaseInstaller $installer)
 Insert Main Page with default content. More...
 
 createSysop ()
 Create the first user account, grant it sysop, bureaucrat and interface-admin rights. More...
 
 disableTimeLimit ()
 Disable the time limit for execution. More...
 
 doGenerateKeys ( $keys)
 Generate a secret value for variables using a secure generator. More...
 
 envCheck64Bit ()
 Checks if we're running on 64 bit or not. More...
 
 envCheckCache ()
 Environment check for compiled object cache types. More...
 
 envCheckDB ()
 Environment check for DB types. More...
 
 envCheckDiff3 ()
 Search for GNU diff3. More...
 
 envCheckGit ()
 Search for git. More...
 
 envCheckGraphics ()
 Environment check for ImageMagick and GD. More...
 
 envCheckLibicu ()
 Check the libicu version. More...
 
 envCheckMemory ()
 Environment check for available memory. More...
 
 envCheckModSecurity ()
 Scare user to death if they have mod_security or mod_security2. More...
 
 envCheckPath ()
 Environment check to inform user which paths we've assumed. More...
 
 envCheckPCRE ()
 Environment check for the PCRE module. More...
 
 envCheckServer ()
 Environment check to inform user which server we've assumed. More...
 
 envCheckShellLocale ()
 Environment check for preferred locale in shell. More...
 
 envCheckSuhosinMaxValueLength ()
 Checks if suhosin.get.max_value_length is set, and if so generate a warning because it is incompatible with ResourceLoader. More...
 
 envCheckUploadsDirectory ()
 Environment check for the permissions of the uploads directory. More...
 
 envGetDefaultServer ()
 Helper function to be called from envPrepServer() More...
 
 envPrepPath ()
 Environment prep for setting $IP and $wgScriptPath. More...
 
 envPrepServer ()
 Environment prep for the server hostname. More...
 
 findExtensionsByType ( $type='extension', $directory='extensions')
 Find extensions or skins, and return an array containing the value for 'Name' for each found extension. More...
 
 getAutoExtensionData ()
 Auto-detect extensions with an extension.json file. More...
 
 getAutoExtensionLegacyHooks ()
 Auto-detect extensions with an old style .php registration file, load the extensions, and return the merged $wgHooks array. More...
 
 getDocUrl ( $page)
 Overridden by WebInstaller to provide lastPage parameters. More...
 
 getExtensionInfo ( $type, $parentRelPath, $name)
 
 getInstallSteps (DatabaseInstaller $installer)
 Get an array of install steps. More...
 
 includeExtensionFiles ( $files)
 Include the specified extension PHP files. More...
 
 includeExtensions ()
 Installs the auto-detected extensions. More...
 

Protected Attributes

HookContainer null $autoExtensionHookContainer
 
array $compiledDBs
 List of detected DBs, access using getCompiledDBs(). More...
 
array $dbInstallers = []
 Cached DB installer instances, access using getDBInstaller(). More...
 
array $defaultVarNames
 MediaWiki configuration globals that will eventually be passed through to LocalSettings.php. More...
 
array $envChecks
 A list of environment check methods called by doEnvironmentChecks(). More...
 
array $envPreps
 A list of environment preparation methods called by doEnvironmentPreps(). More...
 
array $extraInstallSteps = []
 Extra steps for installation, for things like DatabaseInstallers to modify. More...
 
array $internalDefaults
 Variables that are stored alongside globals, and are used for any configuration of the installation process aside from the MediaWiki configuration. More...
 
int $minMemorySize = 50
 Minimum memory size in MiB. More...
 
array $objectCaches
 Known object cache types and the functions used to test for their existence. More...
 
ParserOptions $parserOptions
 Cached ParserOptions, used by parse(). More...
 
Title $parserTitle
 Cached Title, used by parse(). More...
 
array $settings
 

Static Protected Attributes

static array $dbTypes
 Known database types. More...
 

Private Member Functions

 readExtension ( $fullJsonFile, $extDeps=[], $skinDeps=[])
 
 subscribeToMediaWikiAnnounce ()
 

Private Attributes

array[] $installSteps = []
 The actual list of installation steps. More...
 
const MEDIAWIKI_ANNOUNCE_URL
 URL to mediawiki-announce list summary page. More...
 

Detailed Description

Base installer class.

This class provides the base for installation and update functionality for both MediaWiki core and extensions.

Since
1.17

Definition at line 54 of file Installer.php.

Constructor & Destructor Documentation

◆ __construct()

Installer::__construct ( )

Constructor, always call this from child classes.

Definition at line 404 of file Installer.php.

References $internalDefaults, $type, doEnvironmentPreps(), getDBInstaller(), getInstallerConfig(), Title\newFromText(), and resetMediaWikiServices().

Member Function Documentation

◆ addInstallStep()

Installer::addInstallStep (   $callback,
  $findStep = 'BEGINNING' 
)

Add an installation step following the given step.

Parameters
array$callbackA valid installation callback array, in this form: [ 'name' => 'some-unique-name', 'callback' => [ $obj, 'function' ] ];
string$findStepThe step to find. Omit to put the step at the beginning

Definition at line 1973 of file Installer.php.

◆ apacheModulePresent()

static Installer::apacheModulePresent (   $moduleName)
static

Checks for presence of an Apache module.

Works only if PHP is running as an Apache module, too.

Parameters
string$moduleNameName of module to check.
Returns
bool

Definition at line 1253 of file Installer.php.

◆ createMainpage()

Installer::createMainpage ( DatabaseInstaller  $installer)
protected

Insert Main Page with default content.

Parameters
DatabaseInstaller$installer
Returns
Status

Definition at line 1885 of file Installer.php.

References $content, $title, EDIT_NEW, StatusValue\newGood(), Title\newMainPage(), User\newSystemUser(), and wfMessage().

◆ createSysop()

Installer::createSysop ( )
protected

Create the first user account, grant it sysop, bureaucrat and interface-admin rights.

Returns
Status

Definition at line 1781 of file Installer.php.

References SiteStatsUpdate\factory(), getVar(), StatusValue\newFatal(), User\newFromName(), StatusValue\newGood(), and subscribeToMediaWikiAnnounce().

◆ dirIsExecutable()

Installer::dirIsExecutable (   $dir,
  $url 
)

Checks if scripts located in the given directory can be executed via the given URL.

Used only by environment checks.

Parameters
string$dir
string$url
Returns
bool|int|string

Reimplemented in CliInstaller.

Definition at line 1198 of file Installer.php.

References $ext, $file, and $source.

Referenced by envCheckUploadsDirectory().

◆ disableLinkPopups()

Installer::disableLinkPopups ( )

Definition at line 751 of file Installer.php.

◆ disableTimeLimit()

Installer::disableTimeLimit ( )
protected

Disable the time limit for execution.

Some long-running pages (Install, Upgrade) will want to do this

Definition at line 1981 of file Installer.php.

Referenced by WebInstaller\execute().

◆ doEnvironmentChecks()

Installer::doEnvironmentChecks ( )

Do initial checks of the PHP environment.

Set variables according to the observed environment.

It's possible that this may be called under the CLI SAPI, not the SAPI that the wiki will primarily run under. In that case, the subclass should initialise variables such as wgScriptPath, before calling this function.

Under the web subclass, it can already be assumed that PHP 5+ is in use and that sessions are working.

Returns
Status

Definition at line 529 of file Installer.php.

References StatusValue\newFatal(), StatusValue\newGood(), setVar(), showError(), and showMessage().

◆ doEnvironmentPreps()

Installer::doEnvironmentPreps ( )

Definition at line 554 of file Installer.php.

Referenced by __construct().

◆ doGenerateKeys()

Installer::doGenerateKeys (   $keys)
protected

Generate a secret value for variables using a secure generator.

Parameters
array$keys
Returns
Status

Definition at line 1768 of file Installer.php.

References $keys, MWCryptRand\generateHex(), StatusValue\newGood(), and setVar().

Referenced by generateKeys().

◆ envCheck64Bit()

Installer::envCheck64Bit ( )
protected

Checks if we're running on 64 bit or not.

32 bit is becoming increasingly hard to support, so let's at least warn people.

Returns
bool

Definition at line 1135 of file Installer.php.

References showMessage().

◆ envCheckCache()

Installer::envCheckCache ( )
protected

Environment check for compiled object cache types.

Definition at line 890 of file Installer.php.

References setVar(), and showMessage().

◆ envCheckDB()

Installer::envCheckDB ( )
protected

Environment check for DB types.

Returns
bool

Definition at line 796 of file Installer.php.

References $wgLang, getCompiledDBs(), getDBInstaller(), getVar(), showError(), showStatusMessage(), and wfMessage().

◆ envCheckDiff3()

Installer::envCheckDiff3 ( )
protected

Search for GNU diff3.

Returns
bool

Definition at line 922 of file Installer.php.

References ExecutableFinder\findInDefaultPaths(), setVar(), showMessage(), and wfIsWindows().

◆ envCheckGit()

Installer::envCheckGit ( )
protected

Search for git.

Since
1.22
Returns
bool

Definition at line 969 of file Installer.php.

References ExecutableFinder\findInDefaultPaths(), setVar(), showMessage(), and wfIsWindows().

◆ envCheckGraphics()

Installer::envCheckGraphics ( )
protected

Environment check for ImageMagick and GD.

Returns
bool

Definition at line 945 of file Installer.php.

References ExecutableFinder\findInDefaultPaths(), setVar(), showMessage(), and wfIsWindows().

◆ envCheckLibicu()

Installer::envCheckLibicu ( )
protected

Check the libicu version.

Definition at line 1146 of file Installer.php.

References showMessage().

◆ envCheckMemory()

Installer::envCheckMemory ( )
protected

Environment check for available memory.

Returns
bool

Definition at line 864 of file Installer.php.

References setVar(), showMessage(), and wfShorthandToInteger().

◆ envCheckModSecurity()

Installer::envCheckModSecurity ( )
protected

Scare user to death if they have mod_security or mod_security2.

Returns
bool

Definition at line 909 of file Installer.php.

References showMessage().

◆ envCheckPath()

Installer::envCheckPath ( )
protected

Environment check to inform user which paths we've assumed.

Returns
bool

Reimplemented in WebInstaller, and CliInstaller.

Definition at line 1004 of file Installer.php.

References getVar(), and showMessage().

◆ envCheckPCRE()

Installer::envCheckPCRE ( )
protected

Environment check for the PCRE module.

Note
If this check were to fail, the parser would probably throw an exception before the result of this check is shown to the user.
Returns
bool

Definition at line 842 of file Installer.php.

References showError().

◆ envCheckServer()

Installer::envCheckServer ( )
protected

Environment check to inform user which server we've assumed.

Returns
bool

Definition at line 991 of file Installer.php.

References envGetDefaultServer(), and showMessage().

◆ envCheckShellLocale()

Installer::envCheckShellLocale ( )
protected

Environment check for preferred locale in shell.

Returns
bool

Definition at line 1017 of file Installer.php.

References $lang, $line, $lines, getVar(), and setVar().

◆ envCheckSuhosinMaxValueLength()

Installer::envCheckSuhosinMaxValueLength ( )
protected

Checks if suhosin.get.max_value_length is set, and if so generate a warning because it is incompatible with ResourceLoader.

Returns
bool

Definition at line 1117 of file Installer.php.

References showError().

◆ envCheckUploadsDirectory()

Installer::envCheckUploadsDirectory ( )
protected

Environment check for the permissions of the uploads directory.

Returns
bool

Definition at line 1098 of file Installer.php.

References $IP, dirIsExecutable(), getVar(), and showMessage().

◆ envGetDefaultServer()

Installer::envGetDefaultServer ( )
abstractprotected

Helper function to be called from envPrepServer()

Returns
string

Reimplemented in WebInstaller, and CliInstaller.

Referenced by envCheckServer(), and envPrepServer().

◆ envPrepPath()

Installer::envPrepPath ( )
protected

Environment prep for setting $IP and $wgScriptPath.

Reimplemented in WebInstaller.

Definition at line 1184 of file Installer.php.

References $IP, and setVar().

◆ envPrepServer()

Installer::envPrepServer ( )
protected

Environment prep for the server hostname.

Definition at line 1168 of file Installer.php.

References envGetDefaultServer(), and setVar().

◆ findExtensions()

Installer::findExtensions (   $directory = 'extensions')

Find extensions or skins in a subdirectory of $IP.

Returns an array containing the value for 'Name' for each found extension.

Parameters
string$directoryDirectory to search in, relative to $IP, must be either "extensions" or "skins"
Returns
Status An object containing an error list. If there were no errors, an associative array of information about the extension can be found in $status->value.

Definition at line 1293 of file Installer.php.

References findExtensionsByType().

Referenced by CliInstaller\__construct().

◆ findExtensionsByType()

Installer::findExtensionsByType (   $type = 'extension',
  $directory = 'extensions' 
)
protected

Find extensions or skins, and return an array containing the value for 'Name' for each found extension.

Parameters
string$typeEither "extension" or "skin"
string$directoryDirectory to search in, relative to $IP
Returns
Status An object containing an error list. If there were no errors, an associative array of information about the extension can be found in $status->value.

Definition at line 1313 of file Installer.php.

References $file, $type, getExtensionInfo(), getVar(), and StatusValue\newGood().

Referenced by findExtensions().

◆ generateKeys()

Installer::generateKeys ( )

Generate $wgSecretKey.

Will warn if we had to use an insecure random source.

Returns
Status

Definition at line 1740 of file Installer.php.

References $keys, doGenerateKeys(), and getVar().

◆ getAutoExtensionData()

Installer::getAutoExtensionData ( )
protected

Auto-detect extensions with an extension.json file.

Load the extensions, populate $wgAutoloadClasses and return the merged registry data.

Returns
array

Definition at line 1602 of file Installer.php.

References $queue, $wgAutoloadClasses, and getVar().

Referenced by includeExtensions().

◆ getAutoExtensionHookContainer()

Installer::getAutoExtensionHookContainer ( )

Get the hook container previously populated by includeExtensions().

Access: internal
For use by DatabaseInstaller
Since
1.36
Returns
HookContainer

Definition at line 1626 of file Installer.php.

References $autoExtensionHookContainer.

◆ getAutoExtensionLegacyHooks()

Installer::getAutoExtensionLegacyHooks ( )
protected

Auto-detect extensions with an old style .php registration file, load the extensions, and return the merged $wgHooks array.

Returns
array

Definition at line 1541 of file Installer.php.

References getVar(), and includeExtensionFiles().

Referenced by includeExtensions().

◆ getCompiledDBs()

Installer::getCompiledDBs ( )

Get a list of DBs supported by current PHP setup.

Returns
array

Definition at line 589 of file Installer.php.

References $compiledDBs.

Referenced by envCheckDB().

◆ getDBInstaller()

Installer::getDBInstaller (   $type = false)

Get an instance of DatabaseInstaller for the specified DB type.

Parameters
mixed$typeDB installer for which is needed, false to use default.
Returns
DatabaseInstaller

Definition at line 611 of file Installer.php.

References $type, getDBInstallerClass(), and getVar().

Referenced by __construct(), LocalSettingsGenerator\__construct(), envCheckDB(), and performInstallation().

◆ getDBInstallerClass()

static Installer::getDBInstallerClass (   $type)
static

Get the DatabaseInstaller class name for this type.

Parameters
string$typedatabase type ($wgDBtype)
Returns
string Class name
Since
1.30

Definition at line 600 of file Installer.php.

References $type.

Referenced by UpdateMediaWiki\execute(), and getDBInstaller().

◆ getDBTypes()

static Installer::getDBTypes ( )
static

Get a list of known DB types.

Returns
array

Definition at line 512 of file Installer.php.

References $dbTypes.

Referenced by WebInstallerDBConnect\execute(), WebInstallerExistingWiki\handleExistingUpgrade(), and DatabaseUpdater\newForDB().

◆ getDefaultSkin()

Installer::getDefaultSkin ( array  $skinNames)

Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings, but will fall back to another if the default skin is missing and some other one is present instead.

Parameters
string[]$skinNamesNames of installed skins.
Returns
string

Definition at line 1495 of file Installer.php.

Referenced by CliInstaller\__construct().

◆ getDocUrl()

Installer::getDocUrl (   $page)
protected

Overridden by WebInstaller to provide lastPage parameters.

Parameters
string$page
Returns
string

Reimplemented in WebInstaller.

Definition at line 1280 of file Installer.php.

◆ getExistingLocalSettings()

static Installer::getExistingLocalSettings ( )
static

Determine if LocalSettings.php exists.

If it does, return its variables.

Returns
array|false

Definition at line 631 of file Installer.php.

References $IP, $wgAutoloadClasses, $wgExtensionDirectory, and $wgStyleDirectory.

Referenced by CliInstaller\execute(), WebInstallerExistingWiki\execute(), and DatabaseUpdater\loadExtensions().

◆ getExtensionInfo()

Installer::getExtensionInfo (   $type,
  $parentRelPath,
  $name 
)
protected
Parameters
string$typeEither "extension" or "skin"
string$parentRelPathThe parent directory relative to $IP
string$nameThe extension or skin name
Returns
Status An object containing an error list. If there were no errors, an associative array of information about the extension can be found in $status->value.

Definition at line 1357 of file Installer.php.

References $path, $type, getVar(), StatusValue\newFatal(), StatusValue\newGood(), and readExtension().

Referenced by findExtensionsByType(), and CliInstaller\validateExtensions().

◆ getFakePassword()

Installer::getFakePassword (   $realPassword)

Get a fake password for sending back to the user in HTML.

This is a security mechanism to avoid compromise of the password in the event of session ID compromise.

Parameters
string$realPassword
Returns
string

Definition at line 671 of file Installer.php.

Referenced by WebInstaller\getPasswordBox().

◆ getInstallerConfig()

static Installer::getInstallerConfig ( Config  $baseConfig)
static

Constructs a Config object that contains configuration settings that should be overwritten for the installation process.

Since
1.27
Parameters
Config$baseConfig
Returns
Config The config to use during installation.

Definition at line 366 of file Installer.php.

References $objectCaches, CACHE_ANYTHING, CACHE_DB, CACHE_MEMCACHED, CACHE_NONE, and Config\get().

Referenced by __construct().

◆ getInstallSteps()

Installer::getInstallSteps ( DatabaseInstaller  $installer)
protected

Get an array of install steps.

Should always be in the format of [ 'name' => 'someuniquename', 'callback' => [ $obj, 'method' ], ] There must be a config-install-$name message defined per step, which will be shown on install.

Parameters
DatabaseInstaller$installerDatabaseInstaller so we can make callbacks
Returns
array[]

Definition at line 1647 of file Installer.php.

References $installSteps, and getVar().

Referenced by performInstallation().

◆ getParserOptions()

Installer::getParserOptions ( )
Returns
ParserOptions

Definition at line 747 of file Installer.php.

References $parserOptions.

◆ getVar()

◆ includeExtensionFiles()

Installer::includeExtensionFiles (   $files)
protected

Include the specified extension PHP files.

Populate $wgAutoloadClasses and return the LoadExtensionSchemaUpdates hooks.

Parameters
string[]$files
Returns
array LoadExtensionSchemaUpdates legacy hooks

Definition at line 1565 of file Installer.php.

References $file, $IP, $wgAutoloadClasses, $wgHooks, and getVar().

Referenced by getAutoExtensionLegacyHooks().

◆ includeExtensions()

Installer::includeExtensions ( )
protected

Installs the auto-detected extensions.

Returns
Status

Definition at line 1509 of file Installer.php.

References getAutoExtensionData(), getAutoExtensionLegacyHooks(), and StatusValue\newGood().

◆ maybeGetWebserverPrimaryGroup()

static Installer::maybeGetWebserverPrimaryGroup ( )
static

On POSIX systems return the primary group of the webserver we're running under.

On other systems just returns null.

This is used to advice the user that he should chgrp his mw-config/data/images directory as the webserver user before he can install.

Public because SqliteInstaller needs it, and doesn't subclass Installer.

Returns
mixed

Definition at line 699 of file Installer.php.

Referenced by SqliteInstaller\checkDataDir().

◆ overrideConfig()

static Installer::overrideConfig ( )
static

Override the necessary bits of the config to run an installation.

Definition at line 1916 of file Installer.php.

References CACHE_NONE.

◆ parse()

Installer::parse (   $text,
  $lineStart = false 
)

Convert wikitext $text to HTML.

This is potentially error prone since many parser features require a complete installed MW database. The solution is to just not use those features when you write your messages. This appears to work well enough. Basic formatting and external links work just fine.

But in case a translator decides to throw in a "#ifexist" or internal link or whatever, this function is guarded to catch the attempted DB access and to present some fallback text.

Parameters
string$text
bool$lineStart
Returns
string

Definition at line 727 of file Installer.php.

References Parser\stripOuterParagraph().

Referenced by WebInstaller\getCheckBox(), WebInstaller\getHelpBox(), WebInstaller\getInfoBox(), WebInstaller\getRadioElements(), WebInstaller\makeDownloadLinkHtml(), and WebInstaller\showMessage().

◆ performInstallation()

Installer::performInstallation (   $startCB,
  $endCB 
)

Actually perform the installation.

Parameters
callable$startCBA callback array for the beginning of each step
callable$endCBA callback array for the end of each step
Returns
Status[]

Definition at line 1703 of file Installer.php.

References getDBInstaller(), getInstallSteps(), setVar(), and showMessage().

Referenced by CliInstaller\execute().

◆ populateSiteStats()

Installer::populateSiteStats ( DatabaseInstaller  $installer)

Install step which adds a row to the site_stats table with appropriate initial values.

Parameters
DatabaseInstaller$installer
Returns
Status

Definition at line 768 of file Installer.php.

References DatabaseInstaller\getConnection(), and StatusValue\newGood().

◆ readExtension()

Installer::readExtension (   $fullJsonFile,
  $extDeps = [],
  $skinDeps = [] 
)
private
Parameters
string$fullJsonFile
array$extDeps
array$skinDeps
Returns
Status On success, an array of extension information is in $status->value. On failure, the Status object will have an error list.

Definition at line 1411 of file Installer.php.

References $type, getVar(), StatusValue\newFatal(), and StatusValue\newGood().

Referenced by getExtensionInfo().

◆ resetMediaWikiServices()

Installer::resetMediaWikiServices ( Config  $installerConfig = null,
  $serviceOverrides = [] 
)

Reset the global service container and associated global state to accommodate different stages of the installation.

Since
1.35
Parameters
Config | null$installerConfigConfig override. If null, the previous config will be inherited.
array$serviceOverridesService definition overrides. Values can be null to disable specific overrides that would be applied per default, namely 'InterwikiLookup' and 'UserOptionsLookup'.
Returns
MediaWikiServices
Exceptions
MWException

Definition at line 448 of file Installer.php.

References $lang, $wgLang, $wgObjectCaches, RequestContext\getMain(), getVar(), User\newFromId(), setParserLanguage(), and StubGlobalUser\setUser().

Referenced by __construct(), and restoreServices().

◆ restoreLinkPopups()

Installer::restoreLinkPopups ( )

Definition at line 755 of file Installer.php.

References $wgExternalLinkTarget.

◆ restoreServices()

Installer::restoreServices ( )

Restore services that have been redefined in the early stage of installation.

Returns
Status

Definition at line 1753 of file Installer.php.

References StatusValue\newGood(), and resetMediaWikiServices().

◆ setParserLanguage()

Installer::setParserLanguage (   $lang)

ParserOptions are constructed before we determined the language, so fix it.

Parameters
Language$lang

Definition at line 1270 of file Installer.php.

References $lang.

Referenced by resetMediaWikiServices().

◆ setPassword()

Installer::setPassword (   $name,
  $value 
)

Set a variable which stores a password, except if the new value is a fake password in which case leave it as it is.

Parameters
string$name
mixed$value

Definition at line 682 of file Installer.php.

References setVar().

Referenced by WebInstaller\setVarsFromRequest().

◆ setVar()

Installer::setVar (   $name,
  $value 
)

◆ showError()

Installer::showError (   $msg,
  $params 
)
abstract

Same as showMessage(), but for displaying errors.

Parameters
string$msg
mixed...$params

Reimplemented in WebInstaller, and CliInstaller.

Referenced by doEnvironmentChecks(), envCheckDB(), envCheckPCRE(), and envCheckSuhosinMaxValueLength().

◆ showMessage()

Installer::showMessage (   $msg,
  $params 
)
abstract

UI interface for displaying a short message The parameters are like parameters to wfMessage().

The messages will be in wikitext format, which will be converted to an output format such as HTML or text before being sent to the user.

Parameters
string$msg
mixed...$params

Reimplemented in WebInstaller, and CliInstaller.

Referenced by doEnvironmentChecks(), envCheck64Bit(), envCheckCache(), envCheckDiff3(), envCheckGit(), envCheckGraphics(), envCheckLibicu(), envCheckMemory(), envCheckModSecurity(), envCheckPath(), envCheckServer(), envCheckUploadsDirectory(), and performInstallation().

◆ showStatusMessage()

Installer::showStatusMessage ( Status  $status)
abstract

Show a message to the installing user by using a Status object.

Parameters
Status$status

Reimplemented in WebInstaller, and CliInstaller.

Referenced by envCheckDB().

◆ subscribeToMediaWikiAnnounce()

Installer::subscribeToMediaWikiAnnounce ( )
private
Returns
Status

Definition at line 1827 of file Installer.php.

References getVar(), StatusValue\newGood(), wfMessage(), and Status\wrap().

Referenced by createSysop().

Member Data Documentation

◆ $autoExtensionHookContainer

HookContainer null Installer::$autoExtensionHookContainer
protected

Definition at line 331 of file Installer.php.

Referenced by getAutoExtensionHookContainer().

◆ $compiledDBs

array Installer::$compiledDBs
protected

List of detected DBs, access using getCompiledDBs().

Definition at line 80 of file Installer.php.

Referenced by getCompiledDBs().

◆ $dbInstallers

array Installer::$dbInstallers = []
protected

Cached DB installer instances, access using getDBInstaller().

Definition at line 87 of file Installer.php.

◆ $dbTypes

array Installer::$dbTypes
staticprotected
Initial value:
= [
'mysql',
'postgres',
'sqlite',
]

Known database types.

These correspond to the class names <type>Installer, and are also MediaWiki database types valid for $wgDBtype.

To add a new type, create a <type>Installer class and a Database<type> class, and add a config-type-<type> message to MessagesEn.php.

Definition at line 119 of file Installer.php.

Referenced by getDBTypes().

◆ $defaultVarNames

array Installer::$defaultVarNames
protected
Initial value:
= [
'wgSitename',
'wgPasswordSender',
'wgLanguageCode',
'wgRightsIcon',
'wgRightsText',
'wgRightsUrl',
'wgEnableEmail',
'wgEnableUserEmail',
'wgEnotifUserTalk',
'wgEnotifWatchlist',
'wgEmailAuthentication',
'wgDBname',
'wgDBtype',
'wgDiff3',
'wgImageMagickConvertCommand',
'wgGitBin',
'IP',
'wgScriptPath',
'wgMetaNamespace',
'wgDeletedDirectory',
'wgEnableUploads',
'wgShellLocale',
'wgSecretKey',
'wgUseInstantCommons',
'wgUpgradeKey',
'wgDefaultSkin',
'wgPingback',
]

MediaWiki configuration globals that will eventually be passed through to LocalSettings.php.

The names only are given here, the defaults typically come from DefaultSettings.php.

Definition at line 171 of file Installer.php.

◆ $envChecks

array Installer::$envChecks
protected
Initial value:
= [
'envCheckDB',
'envCheckPCRE',
'envCheckMemory',
'envCheckCache',
'envCheckModSecurity',
'envCheckDiff3',
'envCheckGraphics',
'envCheckGit',
'envCheckServer',
'envCheckPath',
'envCheckShellLocale',
'envCheckUploadsDirectory',
'envCheckLibicu',
'envCheckSuhosinMaxValueLength',
'envCheck64Bit',
]

A list of environment check methods called by doEnvironmentChecks().

These may output warnings using showMessage(), and/or abort the installation process by returning false.

For the WebInstaller these are only called on the Welcome page, if these methods have side-effects that should affect later page loads (as well as the generated stylesheet), use envPreps instead.

Definition at line 136 of file Installer.php.

◆ $envPreps

array Installer::$envPreps
protected
Initial value:
= [
'envPrepServer',
'envPrepPath',
]

A list of environment preparation methods called by doEnvironmentPreps().

Definition at line 159 of file Installer.php.

◆ $extraInstallSteps

array Installer::$extraInstallSteps = []
protected

Extra steps for installation, for things like DatabaseInstallers to modify.

Definition at line 252 of file Installer.php.

◆ $installSteps

array [] Installer::$installSteps = []
private

The actual list of installation steps.

This will be initialized by getInstallSteps()

Definition at line 245 of file Installer.php.

Referenced by getInstallSteps().

◆ $internalDefaults

array Installer::$internalDefaults
protected
Initial value:
= [
'_UserLang' => 'en',
'_Environment' => false,
'_RaiseMemory' => false,
'_UpgradeDone' => false,
'_InstallDone' => false,
'_Caches' => [],
'_InstallPassword' => '',
'_SameAccount' => true,
'_CreateDBAccount' => false,
'_NamespaceType' => 'site-name',
'_AdminName' => '',
'_AdminPassword' => '',
'_AdminPasswordConfirm' => '',
'_AdminEmail' => '',
'_Subscribe' => false,
'_SkipOptional' => 'continue',
'_RightsProfile' => 'wiki',
'_LicenseCode' => 'none',
'_CCDone' => false,
'_Extensions' => [],
'_Skins' => [],
'_MemCachedServers' => '',
'_UpgradeKeySupplied' => false,
'_ExistingDBSettings' => false,
'_Logo' => '$wgResourceBasePath/resources/assets/wiki.png',
'wgAuthenticationTokenVersion' => 1,
]

Variables that are stored alongside globals, and are used for any configuration of the installation process aside from the MediaWiki configuration.

Map of names to defaults.

Definition at line 208 of file Installer.php.

Referenced by __construct().

◆ $licenses

array Installer::$licenses

License types.

Definition at line 294 of file Installer.php.

◆ $minMemorySize

int Installer::$minMemorySize = 50
protected

Minimum memory size in MiB.

Definition at line 94 of file Installer.php.

◆ $objectCaches

array Installer::$objectCaches
protected
Initial value:
= [
'apcu' => 'apcu_fetch',
'wincache' => 'wincache_ucache_get'
]

Known object cache types and the functions used to test for their existence.

Definition at line 259 of file Installer.php.

Referenced by getInstallerConfig().

◆ $parserOptions

ParserOptions Installer::$parserOptions
protected

Cached ParserOptions, used by parse().

Definition at line 108 of file Installer.php.

Referenced by getParserOptions().

◆ $parserTitle

Title Installer::$parserTitle
protected

Cached Title, used by parse().

Definition at line 101 of file Installer.php.

◆ $rightsProfiles

array Installer::$rightsProfiles
Initial value:
= [
'wiki' => [],
'no-anon' => [
'*' => [ 'edit' => false ]
],
'fishbowl' => [
'*' => [
'createaccount' => false,
'edit' => false,
],
],
'private' => [
'*' => [
'createaccount' => false,
'edit' => false,
'read' => false,
],
],
]

User rights profiles.

Definition at line 269 of file Installer.php.

◆ $settings

array Installer::$settings
protected

Definition at line 73 of file Installer.php.

Referenced by WebInstaller\execute(), and WebInstaller\finish().

◆ MEDIAWIKI_ANNOUNCE_URL

const Installer::MEDIAWIKI_ANNOUNCE_URL
private
Initial value:
=
'https://lists.wikimedia.org/postorius/lists/mediawiki-announce.lists.wikimedia.org/'

URL to mediawiki-announce list summary page.

Definition at line 67 of file Installer.php.

◆ MINIMUM_PCRE_VERSION

const Installer::MINIMUM_PCRE_VERSION = '7.2'

The oldest version of PCRE we can support.

Defining this is necessary because PHP may be linked with a system version of PCRE, which may be older than that bundled with the minimum PHP version.

Definition at line 62 of file Installer.php.

Referenced by UpdateMediaWiki\compatChecks().


The documentation for this class was generated from the following file: