[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/installer/ -> Installer.php (summary)

Base code for MediaWiki installer. 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.

File Size: 1813 lines (47 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 65 functions

  __construct()
  getDBTypes()
  doEnvironmentChecks()
  doEnvironmentPreps()
  setVar()
  getVar()
  getCompiledDBs()
  getDBInstaller()
  getExistingLocalSettings()
  getFakePassword()
  setPassword()
  maybeGetWebserverPrimaryGroup()
  parse()
  getParserOptions()
  disableLinkPopups()
  restoreLinkPopups()
  populateSiteStats()
  exportVars()
  envCheckDB()
  envCheckRegisterGlobals()
  envCheckBrokenXML()
  envCheckMagicQuotes()
  envCheckMbstring()
  envCheckSafeMode()
  envCheckXML()
  envCheckPCRE()
  envCheckMemory()
  envCheckCache()
  envCheckModSecurity()
  envCheckDiff3()
  envCheckGraphics()
  envCheckGit()
  envCheckServer()
  envCheckPath()
  envCheckShellLocale()
  envCheckUploadsDirectory()
  envCheckSuhosinMaxValueLength()
  unicodeChar()
  envCheckLibicu()
  envCheckCtype()
  envCheckIconv()
  envCheckJSON()
  envPrepServer()
  envPrepExtension()
  envPrepPath()
  getPossibleBinPaths()
  locateExecutable()
  locateExecutableInDefaultPaths()
  dirIsExecutable()
  apacheModulePresent()
  setParserLanguage()
  getDocUrl()
  findExtensions()
  getDefaultSkin()
  includeExtensions()
  getInstallSteps()
  performInstallation()
  generateKeys()
  doGenerateKeys()
  createSysop()
  subscribeToMediaWikiAnnounce()
  createMainpage()
  overrideConfig()
  addInstallStep()
  disableTimeLimit()

Functions
Functions that are not part of a class:

__construct()   X-Ref
Constructor, always call this from child classes.


getDBTypes()   X-Ref
Get a list of known DB types.

return: array

doEnvironmentChecks()   X-Ref
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.

return: Status

doEnvironmentPreps()   X-Ref
No description

setVar( $name, $value )   X-Ref
Set a MW configuration variable, or internal installer configuration variable.

param: string $name
param: mixed $value

getVar( $name, $default = null )   X-Ref
Get an MW configuration variable, or internal installer configuration variable.
The defaults come from $GLOBALS (ultimately DefaultSettings.php).
Installer variables are typically prefixed by an underscore.

param: string $name
param: mixed $default
return: mixed

getCompiledDBs()   X-Ref
Get a list of DBs supported by current PHP setup

return: array

getDBInstaller( $type = false )   X-Ref
Get an instance of DatabaseInstaller for the specified DB type.

param: mixed $type DB installer for which is needed, false to use default.
return: DatabaseInstaller

getExistingLocalSettings()   X-Ref
Determine if LocalSettings.php exists. If it does, return its variables.

return: array

getFakePassword( $realPassword )   X-Ref
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.

param: string $realPassword
return: string

setPassword( $name, $value )   X-Ref
Set a variable which stores a password, except if the new value is a
fake password in which case leave it as it is.

param: string $name
param: mixed $value

maybeGetWebserverPrimaryGroup()   X-Ref
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.

return: mixed

parse( $text, $lineStart = false )   X-Ref
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.

param: string $text
param: bool $lineStart
return: string

getParserOptions()   X-Ref

return: ParserOptions

disableLinkPopups()   X-Ref
No description

restoreLinkPopups()   X-Ref
No description

populateSiteStats( DatabaseInstaller $installer )   X-Ref
Install step which adds a row to the site_stats table with appropriate
initial values.

param: DatabaseInstaller $installer
return: Status

exportVars()   X-Ref
Exports all wg* variables stored by the installer into global scope.


envCheckDB()   X-Ref
Environment check for DB types.

return: bool

envCheckRegisterGlobals()   X-Ref
Environment check for register_globals.
Prevent installation if enabled

return: bool

envCheckBrokenXML()   X-Ref
Some versions of libxml+PHP break < and > encoding horribly

return: bool

envCheckMagicQuotes()   X-Ref
Environment check for magic_quotes_(gpc|runtime|sybase).

return: bool

envCheckMbstring()   X-Ref
Environment check for mbstring.func_overload.

return: bool

envCheckSafeMode()   X-Ref
Environment check for safe_mode.

return: bool

envCheckXML()   X-Ref
Environment check for the XML module.

return: bool

envCheckPCRE()   X-Ref
Environment check for the PCRE module.

return: bool

envCheckMemory()   X-Ref
Environment check for available memory.

return: bool

envCheckCache()   X-Ref
Environment check for compiled object cache types.


envCheckModSecurity()   X-Ref
Scare user to death if they have mod_security

return: bool

envCheckDiff3()   X-Ref
Search for GNU diff3.

return: bool

envCheckGraphics()   X-Ref
Environment check for ImageMagick and GD.

return: bool

envCheckGit()   X-Ref
Search for git.

return: bool

envCheckServer()   X-Ref
Environment check to inform user which server we've assumed.

return: bool

envCheckPath()   X-Ref
Environment check to inform user which paths we've assumed.

return: bool

envCheckShellLocale()   X-Ref
Environment check for preferred locale in shell

return: bool

envCheckUploadsDirectory()   X-Ref
Environment check for the permissions of the uploads directory

return: bool

envCheckSuhosinMaxValueLength()   X-Ref
Checks if suhosin.get.max_value_length is set, and if so generate
a warning because it decreases ResourceLoader performance.

return: bool

unicodeChar( $c )   X-Ref
Convert a hex string representing a Unicode code point to that code point.

param: string $c
return: string

envCheckLibicu()   X-Ref
Check the libicu version


envCheckCtype()   X-Ref

return: bool

envCheckIconv()   X-Ref

return: bool

envCheckJSON()   X-Ref

return: bool

envPrepServer()   X-Ref
Environment prep for the server hostname.


envPrepExtension()   X-Ref
Environment prep for setting the preferred PHP file extension.


envPrepPath()   X-Ref
Environment prep for setting $IP and $wgScriptPath.


getPossibleBinPaths()   X-Ref
Get an array of likely places we can find executables. Check a bunch
of known Unix-like defaults, as well as the PATH environment variable
(which should maybe make it work for Windows?)

return: array

locateExecutable( $path, $names, $versionInfo = false )   X-Ref
Search a path for any of the given executable names. Returns the
executable name if found. Also checks the version string returned
by each executable.

Used only by environment checks.

param: string $path Path to search
param: array $names Array of executable names
param: array|bool $versionInfo False or array with two members:
return: bool|string

locateExecutableInDefaultPaths( $names, $versionInfo = false )   X-Ref
Same as locateExecutable(), but checks in getPossibleBinPaths() by default

param: array $names Array of possible names.
param: array|bool $versionInfo Default: false or array with two members:
return: bool|string

dirIsExecutable( $dir, $url )   X-Ref
Checks if scripts located in the given directory can be executed via the given URL.

Used only by environment checks.
param: string $dir
param: string $url
return: bool|int|string

apacheModulePresent( $moduleName )   X-Ref
Checks for presence of an Apache module. Works only if PHP is running as an Apache module, too.

param: string $moduleName Name of module to check.
return: bool

setParserLanguage( $lang )   X-Ref
ParserOptions are constructed before we determined the language, so fix it

param: Language $lang

getDocUrl( $page )   X-Ref
Overridden by WebInstaller to provide lastPage parameters.

param: string $page
return: string

findExtensions( $directory = 'extensions' )   X-Ref
Finds extensions that follow the format /$directory/Name/Name.php,
and returns an array containing the value for 'Name' for each found extension.

Reasonable values for $directory include 'extensions' (the default) and 'skins'.

param: string $directory Directory to search in
return: array

getDefaultSkin( array $skinNames )   X-Ref
Returns a default value to be used for $wgDefaultSkin: the preferred skin, if available among
the installed skins, or any other one otherwise.

param: string[] $skinNames Names of installed skins.
return: string

includeExtensions()   X-Ref
Installs the auto-detected extensions.

return: Status

getInstallSteps( DatabaseInstaller $installer )   X-Ref
Get an array of install steps. Should always be in the format of
array(
'name'     => 'someuniquename',
'callback' => array( $obj, 'method' ),
)
There must be a config-install-$name message defined per step, which will
be shown on install.

param: DatabaseInstaller $installer DatabaseInstaller so we can make callbacks
return: array

performInstallation( $startCB, $endCB )   X-Ref
Actually perform the installation.

param: callable $startCB A callback array for the beginning of each step
param: callable $endCB A callback array for the end of each step
return: array Array of Status objects

generateKeys()   X-Ref
Generate $wgSecretKey. Will warn if we had to use an insecure random source.

return: Status

doGenerateKeys( $keys )   X-Ref
Generate a secret value for variables using our CryptRand generator.
Produce a warning if the random source was insecure.

param: array $keys
return: Status

createSysop()   X-Ref
Create the first user account, grant it sysop and bureaucrat rights

return: Status

subscribeToMediaWikiAnnounce( Status $s )   X-Ref

param: Status $s

createMainpage( DatabaseInstaller $installer )   X-Ref
Insert Main Page with default content.

param: DatabaseInstaller $installer
return: Status

overrideConfig()   X-Ref
Override the necessary bits of the config to run an installation.


addInstallStep( $callback, $findStep = 'BEGINNING' )   X-Ref
Add an installation step following the given step.

param: callable $callback A valid installation callback array, in this form:
param: string $findStep The step to find. Omit to put the step at the beginning

disableTimeLimit()   X-Ref
Disable the time limit for execution.
Some long-running pages (Install, Upgrade) will want to do this




Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1