MediaWiki master
|
Base installer class. More...
Inherited by MediaWiki\Installer\CliInstaller, and MediaWiki\Installer\WebInstaller.
Public Member Functions | |
__construct () | |
Constructor, always call this from child classes. | |
addInstallStep ( $callback, $findStep='BEGINNING') | |
Add an installation step following the given step. | |
dirIsExecutable ( $dir, $url) | |
Checks if scripts located in the given directory can be executed via the given URL. | |
disableLinkPopups () | |
doEnvironmentChecks () | |
Do initial checks of the PHP environment. | |
findExtensions ( $directory='extensions') | |
Find extensions or skins in a subdirectory of $IP. | |
getCompiledDBs () | |
Get a list of DBs supported by current PHP setup. | |
getDBInstaller ( $type=false) | |
Get an instance of DatabaseInstaller for the specified DB type. | |
getDefaultSkin (array $skinNames) | |
Returns a default value to be used for $wgDefaultSkin: normally the DefaultSkin from config-schema.yaml, but will fall back to another if the default skin is missing and some other one is present instead. | |
getFakePassword ( $realPassword) | |
Get a fake password for sending back to the user in HTML. | |
getParserOptions () | |
getVar ( $name, $default=null) | |
Get an MW configuration variable, or internal installer configuration variable. | |
parse ( $text, $lineStart=false) | |
Convert wikitext $text to HTML. | |
performInstallation ( $startCB, $endCB) | |
Actually perform the installation. | |
restoreLinkPopups () | |
setParserLanguage ( $lang) | |
ParserOptions are constructed before we determined the language, so fix it. | |
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. | |
setVar ( $name, $value) | |
Set a MW configuration variable, or internal installer configuration variable. | |
showError ( $msg,... $params) | |
Same as showMessage(), but for displaying errors. | |
showMessage ( $msg,... $params) | |
UI interface for displaying a short message The parameters are like parameters to wfMessage(). | |
showStatusMessage (Status $status) | |
Show a message to the installing user by using a Status object. | |
Static Public Member Functions | |
static | apacheModulePresent ( $moduleName) |
Checks for presence of an Apache module. | |
static | disableStorage (Config $config, string $lang) |
Reset the global service container and associated global state, disabling storage, to support pre-installation operation. | |
static | getDBInstallerClass ( $type) |
Get the DatabaseInstaller class name for this type. | |
static | getDBTypes () |
Get a list of known DB types. | |
static | getExistingLocalSettings () |
Determine if LocalSettings.php exists. | |
static | getInstallerConfig (Config $baseConfig) |
Constructs a Config object that contains configuration settings that should be overwritten for the installation process. | |
static | overrideConfig (SettingsBuilder $settings) |
Override the necessary bits of the config to run an installation. | |
Public Attributes | |
array | $licenses |
License types. | |
array | $rightsProfiles |
User rights profiles. | |
Protected Member Functions | |
detectWebPaths () | |
This is overridden by the web installer to provide the detected wgScriptPath. | |
disableTimeLimit () | |
Disable the time limit for execution. | |
envCheck64Bit () | |
Checks if we're running on 64 bit or not. | |
envCheckCache () | |
Environment check for compiled object cache types. | |
envCheckDB () | |
Environment check for DB types. | |
envCheckDiff3 () | |
Search for GNU diff3. | |
envCheckGit () | |
Search for git. | |
envCheckGraphics () | |
Environment check for ImageMagick and GD. | |
envCheckLibicu () | |
Check and display the libicu and Unicode versions. | |
envCheckMemory () | |
Environment check for available memory. | |
envCheckModSecurity () | |
Scare user to death if they have mod_security or mod_security2. | |
envCheckPath () | |
Environment check to inform user which paths we've assumed. | |
envCheckPCRE () | |
Check for known PCRE-related compatibility issues. | |
envCheckServer () | |
Environment check to inform user which server we've assumed. | |
envCheckUploadsDirectory () | |
Environment check for the permissions of the uploads directory. | |
envCheckUploadsServerResponse () | |
envGetDefaultServer () | |
Helper function to be called from getDefaultSettings() | |
findExtensionsByType ( $type='extension', $directory='extensions') | |
Find extensions or skins, and return an array containing the value for 'Name' for each found extension. | |
getDefaultSettingsOverrides () | |
Override this in a subclass to override the default settings. | |
getDocUrl ( $page) | |
Overridden by WebInstaller to provide lastPage parameters. | |
getExtensionInfo ( $type, $parentRelPath, $name) | |
getTaskList () | |
Get a list of tasks to do. | |
restoreServices () | |
Restore services that have been redefined in the early stage of installation. | |
Protected Attributes | |
HookContainer null | $autoExtensionHookContainer |
array | $compiledDBs |
List of detected DBs, access using getCompiledDBs(). | |
array | $dbInstallers = [] |
Cached DB installer instances, access using getDBInstaller(). | |
array | $envChecks |
A list of environment check methods called by doEnvironmentChecks(). | |
array | $extraInstallSteps = [] |
Extra steps for installation, for things like DatabaseInstallers to modify. | |
array | $internalDefaults |
Variables that are stored alongside globals, and are used for any configuration of the installation process aside from the MediaWiki configuration. | |
int | $minMemorySize = 50 |
Minimum memory size in MiB. | |
array | $objectCaches |
Known object cache types and the functions used to test for their existence. | |
ParserOptions | $parserOptions |
Cached ParserOptions, used by parse(). | |
Title | $parserTitle |
Cached Title, used by parse(). | |
array | $settings |
array | $virtualDomains = [] |
Static Protected Attributes | |
static array | $dbTypes |
Known database types. | |
Base installer class.
This class provides the base for installation and update functionality for both MediaWiki core and extensions.
Definition at line 85 of file Installer.php.
MediaWiki\Installer\Installer::__construct | ( | ) |
Constructor, always call this from child classes.
Definition at line 398 of file Installer.php.
References MediaWiki\Installer\Installer\disableStorage(), MediaWiki\Installer\Installer\getDBInstaller(), MediaWiki\Installer\Installer\getInstallerConfig(), MediaWiki\Installer\Installer\getVar(), and MediaWiki\Installer\Installer\setParserLanguage().
MediaWiki\Installer\Installer::addInstallStep | ( | $callback, | |
$findStep = 'BEGINNING' ) |
Add an installation step following the given step.
array | $callback | A valid installation callback array, in this form: [ 'name' => 'some-unique-name', 'callback' => [ $obj, 'function' ] ]; |
string | $findStep | The step to find. Omit to put the step at the beginning |
Definition at line 1540 of file Installer.php.
|
static |
Checks for presence of an Apache module.
Works only if PHP is running as an Apache module, too.
string | $moduleName | Name of module to check. |
Definition at line 1143 of file Installer.php.
|
protected |
This is overridden by the web installer to provide the detected wgScriptPath.
Reimplemented in MediaWiki\Installer\WebInstaller.
Definition at line 461 of file Installer.php.
MediaWiki\Installer\Installer::dirIsExecutable | ( | $dir, | |
$url ) |
Checks if scripts located in the given directory can be executed via the given URL.
Used only by environment checks.
string | $dir | |
string | $url |
Reimplemented in MediaWiki\Installer\CliInstaller.
Definition at line 1088 of file Installer.php.
References $source, $url, and MediaWiki\MediaWikiServices\getInstance().
MediaWiki\Installer\Installer::disableLinkPopups | ( | ) |
Definition at line 771 of file Installer.php.
|
static |
Reset the global service container and associated global state, disabling storage, to support pre-installation operation.
Config | $config | Config override |
string | $lang | Language code |
Definition at line 501 of file Installer.php.
References $wgLang, $wgObjectCaches, MediaWiki\MediaWikiServices\getInstance(), MediaWiki\MainConfigNames\ObjectCaches, and MediaWiki\MediaWikiServices\resetGlobalInstance().
Referenced by MediaWiki\Installer\Installer\__construct().
|
protected |
Disable the time limit for execution.
Some long-running pages (Install, Upgrade) will want to do this
Definition at line 1548 of file Installer.php.
Referenced by MediaWiki\Installer\WebInstaller\execute().
MediaWiki\Installer\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.
It can already be assumed that a supported PHP version is in use. Under the web subclass, it can also be assumed that sessions are working.
Definition at line 557 of file Installer.php.
|
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.
Definition at line 1058 of file Installer.php.
|
protected |
Environment check for compiled object cache types.
Definition at line 876 of file Installer.php.
|
protected |
Environment check for DB types.
Definition at line 788 of file Installer.php.
References $wgLang, and wfMessage().
|
protected |
Search for GNU diff3.
Definition at line 908 of file Installer.php.
References ExecutableFinder\findInDefaultPaths(), and wfIsWindows().
|
protected |
Search for git.
Definition at line 955 of file Installer.php.
References ExecutableFinder\findInDefaultPaths(), and wfIsWindows().
|
protected |
Environment check for ImageMagick and GD.
Definition at line 931 of file Installer.php.
References ExecutableFinder\findInDefaultPaths(), and wfIsWindows().
|
protected |
Check and display the libicu and Unicode versions.
Definition at line 1069 of file Installer.php.
|
protected |
Environment check for available memory.
Definition at line 850 of file Installer.php.
References wfShorthandToInteger().
|
protected |
Scare user to death if they have mod_security or mod_security2.
Definition at line 895 of file Installer.php.
|
protected |
Environment check to inform user which paths we've assumed.
Reimplemented in MediaWiki\Installer\CliInstaller, and MediaWiki\Installer\WebInstaller.
Definition at line 990 of file Installer.php.
|
protected |
Check for known PCRE-related compatibility issues.
Definition at line 835 of file Installer.php.
|
protected |
Environment check to inform user which server we've assumed.
Definition at line 977 of file Installer.php.
|
protected |
Environment check for the permissions of the uploads directory.
Definition at line 1003 of file Installer.php.
|
protected |
Definition at line 1017 of file Installer.php.
References $url, and MediaWiki\MediaWikiServices\getInstance().
|
abstractprotected |
Helper function to be called from getDefaultSettings()
Reimplemented in MediaWiki\Installer\CliInstaller, and MediaWiki\Installer\WebInstaller.
MediaWiki\Installer\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.
string | $directory | Directory to search in, relative to $IP, must be either "extensions" or "skins" |
Definition at line 1183 of file Installer.php.
Referenced by MediaWiki\Installer\CliInstaller\__construct().
|
protected |
Find extensions or skins, and return an array containing the value for 'Name' for each found extension.
string | $type | Either "extension" or "skin" |
string | $directory | Directory to search in, relative to $IP |
Definition at line 1203 of file Installer.php.
MediaWiki\Installer\Installer::getCompiledDBs | ( | ) |
Get a list of DBs supported by current PHP setup.
Definition at line 604 of file Installer.php.
MediaWiki\Installer\Installer::getDBInstaller | ( | $type = false | ) |
Get an instance of DatabaseInstaller for the specified DB type.
mixed | $type | DB installer for which is needed, false to use default. |
Definition at line 626 of file Installer.php.
Referenced by MediaWiki\Installer\Installer\__construct(), MediaWiki\Installer\WebInstaller\doUpgrade(), and MediaWiki\Installer\WebInstaller\needsUpgrade().
|
static |
Get the DatabaseInstaller class name for this type.
string | $type | database type ($wgDBtype) |
Definition at line 615 of file Installer.php.
|
static |
Get a list of known DB types.
Definition at line 540 of file Installer.php.
Referenced by MediaWiki\Installer\WebInstallerDBConnect\execute(), MediaWiki\Installer\WebInstallerExistingWiki\handleExistingUpgrade(), and MediaWiki\Installer\DatabaseUpdater\newForDB().
|
protected |
Override this in a subclass to override the default settings.
Definition at line 471 of file Installer.php.
MediaWiki\Installer\Installer::getDefaultSkin | ( | array | $skinNames | ) |
Returns a default value to be used for $wgDefaultSkin: normally the DefaultSkin from config-schema.yaml, but will fall back to another if the default skin is missing and some other one is present instead.
string[] | $skinNames | Names of installed skins. |
Definition at line 1384 of file Installer.php.
Referenced by MediaWiki\Installer\CliInstaller\__construct().
|
protected |
Overridden by WebInstaller to provide lastPage parameters.
string | $page |
Reimplemented in MediaWiki\Installer\WebInstaller.
Definition at line 1170 of file Installer.php.
|
static |
Determine if LocalSettings.php exists.
If it does, return its variables.
Definition at line 646 of file Installer.php.
References $IP, $wgAutoloadClasses, $wgExtensionDirectory, $wgStyleDirectory, MediaWiki\MainConfigSchema\listDefaultValues(), wfDetectInstallPath(), and wfDetectLocalSettingsFile().
Referenced by MediaWiki\Installer\CliInstaller\execute(), and MediaWiki\Installer\WebInstallerExistingWiki\execute().
|
protected |
string | $type | Either "extension" or "skin" |
string | $parentRelPath | The parent directory relative to $IP |
string | $name | The extension or skin name |
Definition at line 1247 of file Installer.php.
References $path.
MediaWiki\Installer\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.
string | $realPassword |
Definition at line 712 of file Installer.php.
Referenced by MediaWiki\Installer\WebInstaller\getPasswordBox().
|
static |
Constructs a Config object that contains configuration settings that should be overwritten for the installation process.
Config | $baseConfig |
Definition at line 366 of file Installer.php.
References MediaWiki\Installer\Installer\$objectCaches, CACHE_ANYTHING, CACHE_DB, CACHE_MEMCACHED, CACHE_NONE, MediaWiki\MainConfigNames\ConfigRegistry, MediaWiki\Config\Config\get(), and MediaWiki\MainConfigNames\ObjectCaches.
Referenced by MediaWiki\Installer\Installer\__construct().
MediaWiki\Installer\Installer::getParserOptions | ( | ) |
Definition at line 767 of file Installer.php.
|
protected |
Get a list of tasks to do.
There must be a config-install-$name message defined per step, which will be shown on install.
Definition at line 1412 of file Installer.php.
References MediaWiki\Installer\Task\TaskFactory\PROFILE_INSTALLER.
MediaWiki\Installer\Installer::getVar | ( | $name, | |
$default = null ) |
Get an MW configuration variable, or internal installer configuration variable.
The defaults come from MainConfigSchema. Installer variables are typically prefixed by an underscore.
string | $name | |
mixed | null | $default |
Definition at line 595 of file Installer.php.
Referenced by MediaWiki\Installer\CliInstaller\__construct(), MediaWiki\Installer\Installer\__construct(), MediaWiki\Installer\CliInstaller\envCheckPath(), MediaWiki\Installer\WebInstaller\envGetDefaultServer(), MediaWiki\Installer\CliInstaller\execute(), MediaWiki\Installer\WebInstaller\execute(), MediaWiki\Installer\WebInstaller\getCheckBox(), MediaWiki\Installer\WebInstaller\getPasswordBox(), MediaWiki\Installer\WebInstaller\getRadioElements(), MediaWiki\Installer\WebInstaller\getTextArea(), MediaWiki\Installer\WebInstaller\getTextBox(), and MediaWiki\Installer\WebInstaller\setupLanguage().
|
static |
Override the necessary bits of the config to run an installation.
Definition at line 1479 of file Installer.php.
References CACHE_NONE, MediaWiki\MainConfigNames\CookiePrefix, MediaWiki\MainConfigNames\DisableOutputCompression, MediaWiki\MainConfigNames\ExternalLinkTarget, MediaWiki\MainConfigNames\LanguageConverterCacheType, MediaWiki\MainConfigNames\MainStash, MediaWiki\MainConfigNames\MaxShellMemory, MediaWiki\Settings\SettingsBuilder\overrideConfigValues(), MediaWiki\MainConfigNames\Server, MediaWiki\MainConfigNames\SessionCacheType, MediaWiki\MainConfigNames\SessionProviders, MediaWiki\MainConfigNames\ShowExceptionDetails, MediaWiki\MainConfigNames\ShowHostnames, and MediaWiki\MainConfigNames\UseDatabaseMessages.
MediaWiki\Installer\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.
string | $text | |
bool | $lineStart |
Definition at line 745 of file Installer.php.
References MediaWiki\MediaWikiServices\getInstance().
Referenced by MediaWiki\Installer\WebInstaller\getCheckBox(), MediaWiki\Installer\WebInstaller\getHelpBox(), MediaWiki\Installer\WebInstaller\getInfoBox(), MediaWiki\Installer\WebInstaller\getRadioElements(), MediaWiki\Installer\WebInstaller\makeDownloadLinkHtml(), and MediaWiki\Installer\WebInstaller\showMessage().
MediaWiki\Installer\Installer::performInstallation | ( | $startCB, | |
$endCB ) |
Actually perform the installation.
callable | $startCB | A callback array for the beginning of each step |
callable | $endCB | A callback array for the end of each step |
Definition at line 1448 of file Installer.php.
References MediaWiki\Installer\Task\TaskFactory\PROFILE_INSTALLER.
Referenced by MediaWiki\Installer\CliInstaller\execute().
MediaWiki\Installer\Installer::restoreLinkPopups | ( | ) |
Definition at line 777 of file Installer.php.
References $wgExternalLinkTarget.
|
protected |
Restore services that have been redefined in the early stage of installation.
Definition at line 1470 of file Installer.php.
Referenced by MediaWiki\Installer\WebInstaller\doUpgrade().
MediaWiki\Installer\Installer::setParserLanguage | ( | $lang | ) |
ParserOptions are constructed before we determined the language, so fix it.
Language | $lang |
Definition at line 1160 of file Installer.php.
Referenced by MediaWiki\Installer\Installer\__construct().
MediaWiki\Installer\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.
string | $name | |
mixed | $value |
Definition at line 723 of file Installer.php.
Referenced by MediaWiki\Installer\WebInstaller\setVarsFromRequest().
MediaWiki\Installer\Installer::setVar | ( | $name, | |
$value ) |
Set a MW configuration variable, or internal installer configuration variable.
string | $name | |
mixed | $value |
Definition at line 581 of file Installer.php.
Referenced by MediaWiki\Installer\CliInstaller\__construct(), MediaWiki\Installer\WebInstaller\doUpgrade(), MediaWiki\Installer\CliInstaller\execute(), MediaWiki\Installer\WebInstaller\setupLanguage(), and MediaWiki\Installer\WebInstaller\setVarsFromRequest().
|
abstract |
Same as showMessage(), but for displaying errors.
string | MessageSpecifier | $msg | |
string|int|float | ...$params Message parameters |
Reimplemented in MediaWiki\Installer\CliInstaller, and MediaWiki\Installer\WebInstaller.
|
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.
string | MessageSpecifier | $msg | |
string|int|float | ...$params Message parameters |
Reimplemented in MediaWiki\Installer\CliInstaller, and MediaWiki\Installer\WebInstaller.
|
abstract |
Show a message to the installing user by using a Status object.
Reimplemented in MediaWiki\Installer\CliInstaller, and MediaWiki\Installer\WebInstaller.
|
protected |
Definition at line 328 of file Installer.php.
|
protected |
List of detected DBs, access using getCompiledDBs().
Definition at line 97 of file Installer.php.
|
protected |
Cached DB installer instances, access using getDBInstaller().
Definition at line 104 of file Installer.php.
|
staticprotected |
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 136 of file Installer.php.
|
protected |
A list of environment check methods called by doEnvironmentChecks().
These may output warnings using showMessage(), and/or abort the installation process by returning false.
In the WebInstaller, variables set here will be saved to the session and will be available to later pages in the same session. But if you need dynamic defaults to be available before the welcome page completes, say in the initial CSS request, add something to getDefaultSettings().
Definition at line 154 of file Installer.php.
|
protected |
Extra steps for installation, for things like DatabaseInstallers to modify.
Definition at line 256 of file Installer.php.
|
protected |
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 213 of file Installer.php.
array MediaWiki\Installer\Installer::$licenses |
License types.
Definition at line 297 of file Installer.php.
|
protected |
Minimum memory size in MiB.
Definition at line 111 of file Installer.php.
|
protected |
Known object cache types and the functions used to test for their existence.
Definition at line 263 of file Installer.php.
Referenced by MediaWiki\Installer\Installer\getInstallerConfig().
|
protected |
Cached ParserOptions, used by parse().
Definition at line 125 of file Installer.php.
|
protected |
Cached Title, used by parse().
Definition at line 118 of file Installer.php.
array MediaWiki\Installer\Installer::$rightsProfiles |
User rights profiles.
Definition at line 272 of file Installer.php.
|
protected |
Definition at line 90 of file Installer.php.
Referenced by MediaWiki\Installer\WebInstaller\execute(), and MediaWiki\Installer\WebInstaller\finish().
|
protected |
Definition at line 329 of file Installer.php.