Go to the documentation of this file.
37 'dbtype' =>
'wgDBtype',
38 'dbserver' =>
'wgDBserver',
39 'dbname' =>
'wgDBname',
40 'dbuser' =>
'wgDBuser',
41 'dbpass' =>
'wgDBpassword',
42 'dbprefix' =>
'wgDBprefix',
43 'dbtableoptions' =>
'wgDBTableOptions',
44 'dbport' =>
'wgDBport',
45 'dbschema' =>
'wgDBmwschema',
46 'dbpath' =>
'wgSQLiteDataDir',
47 'server' =>
'wgServer',
48 'scriptpath' =>
'wgScriptPath',
57 function __construct( $siteName, $admin =
null, array $options = [] ) {
60 parent::__construct();
62 if ( isset( $options[
'scriptpath'] ) ) {
63 $this->specifiedScriptPath =
true;
66 foreach ( $this->optionMap as $opt => $global ) {
67 if ( isset( $options[$opt] ) ) {
69 $this->
setVar( $global, $options[$opt] );
73 if ( isset( $options[
'lang'] ) ) {
75 $this->
setVar(
'_UserLang', $options[
'lang'] );
77 $this->
setVar(
'wgLanguageCode', $wgLanguageCode );
78 $wgContLang = MediaWikiServices::getInstance()->getContentLanguage();
83 $this->
setVar(
'wgSitename', $siteName );
85 $metaNS =
$wgContLang->ucfirst( str_replace(
' ',
'_', $siteName ) );
86 if ( $metaNS ==
'MediaWiki' ) {
89 $this->
setVar(
'wgMetaNamespace', $metaNS );
92 $this->
setVar(
'_AdminName', $admin );
95 if ( !isset( $options[
'installdbuser'] ) ) {
96 $this->
setVar(
'_InstallUser',
97 $this->
getVar(
'wgDBuser' ) );
98 $this->
setVar(
'_InstallPassword',
99 $this->
getVar(
'wgDBpassword' ) );
101 $this->
setVar(
'_InstallUser',
102 $options[
'installdbuser'] );
103 $this->
setVar(
'_InstallPassword',
104 $options[
'installdbpass'] ??
"" );
107 $this->
setVar(
'_CreateDBAccount',
true );
110 if ( isset( $options[
'pass'] ) ) {
111 $this->
setVar(
'_AdminPassword', $options[
'pass'] );
115 if ( isset( $options[
'extensions'] ) ) {
117 'extension',
'extensions', $options[
'extensions'] );
118 if ( !$status->isOK() ) {
121 $this->
setVar(
'_Extensions', $status->value );
122 } elseif ( isset( $options[
'with-extensions'] ) ) {
124 if ( !$status->isOK() ) {
127 $this->
setVar(
'_Extensions', array_keys( $status->value ) );
131 if ( isset( $options[
'skins'] ) ) {
133 if ( !$status->isOK() ) {
136 $skins = $status->value;
139 if ( !$status->isOK() ) {
142 $skins = array_keys( $status->value );
144 $this->
setVar(
'_Skins', $skins );
147 $skinNames = array_map(
'strtolower', $skins );
155 foreach ( (array)$nameLists as $nameList ) {
156 foreach ( explode(
',', $nameList ) as $name ) {
157 $name = trim( $name );
158 if ( $name ===
'' ) {
162 if ( $extStatus->isOK() ) {
163 $extensions[] = $name;
165 $status->merge( $extStatus );
169 $extensions = array_unique( $extensions );
170 $status->value = $extensions;
182 if ( count( $this->
getVar(
'_Caches' ) ) ) {
184 $this->
setVar(
'_MainCacheType',
'accel' );
195 [ $this,
'startStage' ],
196 [ $this,
'endStage' ]
200 $lastStepStatus = end( $result );
201 if ( $lastStepStatus->isOK() ) {
204 return $lastStepStatus;
215 $ls->writeFile(
"$path/LocalSettings.php" );
236 echo
"***{$this->getMessageText( $msg, $params )}***\n";
247 $text =
wfMessage( $msg, $params )->parse();
249 $text = preg_replace(
'/<a href="(.*?)".*?>(.*?)<\/a>/',
'$2 <$1>', $text );
264 if ( count( $warnings ) !== 0 ) {
265 foreach ( $warnings as $w ) {
272 if ( !$this->specifiedScriptPath ) {
276 return parent::envCheckPath();
281 return 'http://localhost';
285 $this->
showMessage(
'config-no-cli-uploads-check', $dir );
static newFatal( $message,... $parameters)
Factory function for fatal errors.
envCheckPath()
Environment check to inform user which paths we've assumed.
static stripAllTags( $html)
Take a fragment of (potentially invalid) HTML and return a version with any tags removed,...
getMessageText( $msg, $params)
dirIsExecutable( $dir, $url)
Checks if scripts located in the given directory can be executed via the given URL.
showError( $msg,... $params)
Same as showMessage(), but for displaying errors.
performInstallation( $startCB, $endCB)
Actually perform the installation.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
setVar( $name, $value)
Set a MW configuration variable, or internal installer configuration variable.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
writeConfigurationFile( $path)
Write LocalSettings.php to a given path.
__construct( $siteName, $admin=null, array $options=[])
static getExistingLocalSettings()
Determine if LocalSettings.php exists.
static getLocalSettingsGenerator(Installer $installer)
Instantiates and returns an instance of LocalSettingsGenerator or its descendant classes.
getVar( $name, $default=null)
Get an MW configuration variable, or internal installer configuration variable.
getDefaultSkin(array $skinNames)
Returns a default value to be used for $wgDefaultSkin: normally the one set in DefaultSettings,...
findExtensions( $directory='extensions')
Find extensions or skins in a subdirectory of $IP.
static newGood( $value=null)
Factory function for good results.
$wgLanguageCode
Site language code.
envGetDefaultServer()
Helper function to be called from envPrepServer()
showMessage( $msg,... $params)
UI interface for displaying a short message The parameters are like parameters to wfMessage().
static getMain()
Get the RequestContext object associated with the main request.
execute()
Main entry point.
Class for the core installer command line interface.
getWarningsArray()
Get the list of warnings (but not errors)
endStage( $step, $status)
showStatusMessage(Status $status)
Show a message to the installing user by using a Status object.
static factory( $code)
Get a cached or new language object for a given language code.
getErrorsArray()
Get the list of errors (but not warnings)
validateExtensions( $type, $directory, $nameLists)
getExtensionInfo( $type, $parentRelPath, $name)