MediaWiki
master
Toggle main menu visibility
DatabaseSettingsForm.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Installer;
4
5
use MediaWiki\Html\Html;
6
use MediaWiki\Status\Status;
7
11
class
DatabaseSettingsForm
extends
DatabaseForm
{
12
20
public
function
getHtml
() {
21
return
false
;
22
}
23
30
public
function
submit
() {
31
return
Status::newGood();
32
}
33
41
protected
function
getWebUserBox
( $noCreateMsg =
false
) {
42
$wrapperStyle = $this->
getVar
(
'_SameAccount'
) ?
'display: none'
:
''
;
43
$s =
"<span class=\"cdx-card\"><span class=\"cdx-card__text\">"
.
44
Html::element
(
45
'span'
,
46
[
'class'
=>
'cdx-card__text__title'
],
47
wfMessage
(
'config-db-web-account'
)->text()
48
) .
49
$this->
getCheckBox
(
50
'_SameAccount'
,
'config-db-web-account-same'
,
51
[
'class'
=>
'hideShowRadio cdx-checkbox__input'
,
'rel'
=>
'dbOtherAccount'
]
52
) .
53
Html::openElement(
'div'
, [
'id'
=>
'dbOtherAccount'
,
'style'
=> $wrapperStyle ] ) .
54
$this->
getTextBox
(
'wgDBuser'
,
'config-db-username'
) .
55
$this->
getPasswordBox
(
'wgDBpassword'
,
'config-db-password'
) .
56
$this->webInstaller->getHelpBox(
'config-db-web-help'
);
57
if
( $noCreateMsg ) {
58
$s .= Html::warningBox(
wfMessage
( $noCreateMsg )->parse(),
'config-warning-box'
);
59
}
else
{
60
$s .= $this->
getCheckBox
(
'_CreateDBAccount'
,
'config-db-web-create'
);
61
}
62
$s .= Html::closeElement(
'div'
) .
"</span></span></span>"
;
63
64
return
$s;
65
}
66
72
public
function
submitWebUserBox
() {
73
$this->
setVarsFromRequest
(
74
[
'wgDBuser'
,
'wgDBpassword'
,
'_SameAccount'
,
'_CreateDBAccount'
]
75
);
76
77
if
( $this->
getVar
(
'_SameAccount'
) ) {
78
$this->
setVar
(
'wgDBuser'
, $this->
getVar
(
'_InstallUser'
) );
79
$this->
setVar
(
'wgDBpassword'
, $this->
getVar
(
'_InstallPassword'
) );
80
}
81
82
if
( $this->
getVar
(
'_CreateDBAccount'
) && strval( $this->
getVar
(
'wgDBpassword'
) ) ==
''
) {
83
return
Status::newFatal(
'config-db-password-empty'
, $this->
getVar
(
'wgDBuser'
) );
84
}
85
86
return
Status::newGood();
87
}
88
89
}
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition
GlobalFunctions.php:548
MediaWiki\Installer\DatabaseForm
Definition
DatabaseForm.php:8
MediaWiki\Installer\DatabaseForm\getVar
getVar( $var, $default=null)
Get a variable, taking local defaults into account.
Definition
DatabaseForm.php:23
MediaWiki\Installer\DatabaseForm\getCheckBox
getCheckBox( $var, $label, $attribs=[], $helpData="")
Get a labelled checkbox to configure a local boolean variable.
Definition
DatabaseForm.php:108
MediaWiki\Installer\DatabaseForm\getPasswordBox
getPasswordBox( $var, $label, $attribs=[], $helpData="")
Get a labelled password box to configure a local variable.
Definition
DatabaseForm.php:82
MediaWiki\Installer\DatabaseForm\setVarsFromRequest
setVarsFromRequest( $varNames)
Convenience function to set variables based on form data.
Definition
DatabaseForm.php:148
MediaWiki\Installer\DatabaseForm\getTextBox
getTextBox( $var, $label, $attribs=[], $helpData="")
Get a labelled text box to configure a local variable.
Definition
DatabaseForm.php:54
MediaWiki\Installer\DatabaseForm\setVar
setVar( $name, $value)
Set a variable.
Definition
DatabaseForm.php:32
MediaWiki\Installer\DatabaseSettingsForm
Definition
DatabaseSettingsForm.php:11
MediaWiki\Installer\DatabaseSettingsForm\getHtml
getHtml()
Get HTML for a web form that retrieves settings used for installation.
Definition
DatabaseSettingsForm.php:20
MediaWiki\Installer\DatabaseSettingsForm\submit
submit()
Set variables based on the request array, assuming it was submitted via the form return by getSetting...
Definition
DatabaseSettingsForm.php:30
MediaWiki\Installer\DatabaseSettingsForm\submitWebUserBox
submitWebUserBox()
Submit the form from getWebUserBox().
Definition
DatabaseSettingsForm.php:72
MediaWiki\Installer\DatabaseSettingsForm\getWebUserBox
getWebUserBox( $noCreateMsg=false)
Get a standard web-user fieldset.
Definition
DatabaseSettingsForm.php:41
MediaWiki\Html\element
element(SerializerNode $parent, SerializerNode $node, $contents)
Definition
HtmlHelperTrait.php:38
includes
Installer
DatabaseSettingsForm.php
Generated on
for MediaWiki by
1.18.0