MediaWiki
master
Toggle main menu visibility
WebInstallerPage.php
Go to the documentation of this file.
1
<?php
2
8
9
namespace
MediaWiki\Installer;
10
11
use MediaWiki\Html\Html;
12
19
abstract
class
WebInstallerPage
{
20
26
public
$parent
;
27
31
abstract
public
function
execute
();
32
33
public
function
__construct
(
WebInstaller
$parent
) {
34
$this->parent =
$parent
;
35
}
36
44
public
function
isSlow
() {
45
return
false
;
46
}
47
51
public
function
addHTML
( $html ) {
52
$this->parent->output->addHTML( $html );
53
}
54
55
public
function
startForm
() {
56
$this->
addHTML
(
57
"<div class=\"config-section\">\n"
.
58
Html::openElement(
59
'form'
,
60
[
61
'method'
=>
'post'
,
62
'action'
=> $this->parent->getUrl( [
'page'
=> $this->getName() ] )
63
]
64
) .
"\n"
65
);
66
}
67
72
public
function
endForm
( $continue =
'continue'
, $back =
'back'
) {
73
$s =
"<div class=\"config-submit\">\n"
;
74
$id = $this->
getId
();
75
76
if
( $id ===
false
) {
77
$s .= Html::hidden(
'lastPage'
, $this->parent->request->getVal(
'lastPage'
) );
78
}
79
80
if
( $continue ) {
81
// Fake submit button for enter keypress (T28267)
82
// Messages: config-continue, config-restart, config-regenerate
83
$s .= Html::submitButton(
84
wfMessage
(
"config-$continue"
)->text(),
85
[
86
'name'
=>
"enter-$continue"
,
87
'style'
=>
'width:0;border:0;height:0;padding:0'
88
]
89
) .
"\n"
;
90
}
91
92
if
( $back ) {
93
// Message: config-back
94
$s .= Html::submitButton(
95
wfMessage
(
"config-$back"
)->text(),
96
[
97
'name'
=>
"submit-$back"
,
98
'tabindex'
=> $this->parent->nextTabIndex(),
99
'class'
=> [
'cdx-button'
,
'cdx-button--action-default'
]
100
]
101
) .
"\n"
;
102
}
103
104
if
( $continue ) {
105
// Messages: config-continue, config-restart, config-regenerate
106
$s .= Html::submitButton(
107
wfMessage
(
"config-$continue"
)->text(),
108
[
109
'name'
=>
"submit-$continue"
,
110
'tabindex'
=> $this->parent->nextTabIndex(),
111
'class'
=> [
'cdx-button'
,
'cdx-button--action-progressive'
]
112
]
113
) .
"\n"
;
114
}
115
116
$s .=
"</div></form></div>\n"
;
117
$this->
addHTML
( $s );
118
}
119
123
public
function
getName
() {
124
return
str_replace(
'MediaWiki\\Installer\\WebInstaller'
,
''
, static::class );
125
}
126
130
protected
function
getId
() {
131
return
array_search( $this->
getName
(), $this->parent->pageSequence );
132
}
133
140
public
function
getVar
( $var, $default =
null
) {
141
return
$this->parent->getVar( $var, $default );
142
}
143
148
public
function
setVar
( $name, $value ) {
149
$this->parent->setVar( $name, $value );
150
}
151
159
protected
function
getFieldsetStart
( $legend ) {
160
return
"\n<div class=\"cdx-card\"><div class=\"cdx-card__text\"><div class=\"cdx-card__text__title\">"
.
161
wfMessage
( $legend )->escaped() .
"</div><div class=\"cdx-card__text__description\">\n"
;
162
}
163
169
protected
function
getFieldsetEnd
() {
170
return
"</div></div></div>\n"
;
171
}
172
176
protected
function
startLiveBox
() {
177
$this->
addHTML
(
178
'<div id="config-spinner" style="display:none;">'
.
179
'<img src="images/ajax-loader.gif" /></div>'
.
180
$this->
inlineScript
(
'jQuery( "#config-spinner" ).show();'
) .
181
'<div id="config-live-log">'
.
182
'<textarea name="LiveLog" rows="10" cols="30" readonly="readonly">'
183
);
184
$this->parent->output->flush();
185
}
186
190
protected
function
endLiveBox
() {
191
$this->
addHTML
(
192
'</textarea></div>'
.
193
$this->
inlineScript
(
'jQuery( "#config-spinner" ).hide()'
)
194
);
195
$this->parent->output->flush();
196
}
197
205
protected
function
inlineScript
( $script ) {
206
return
Html::inlineScript( $script, $this->parent->output->getCSPNonce() );
207
}
208
}
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition
GlobalFunctions.php:548
MediaWiki\Installer\WebInstallerPage
Abstract class to define pages for the web installer.
Definition
WebInstallerPage.php:19
MediaWiki\Installer\WebInstallerPage\execute
execute()
MediaWiki\Installer\WebInstallerPage\getFieldsetStart
getFieldsetStart( $legend)
Get the starting tags of a fieldset.
Definition
WebInstallerPage.php:159
MediaWiki\Installer\WebInstallerPage\inlineScript
inlineScript( $script)
Javascript to include inline.
Definition
WebInstallerPage.php:205
MediaWiki\Installer\WebInstallerPage\endForm
endForm( $continue='continue', $back='back')
Definition
WebInstallerPage.php:72
MediaWiki\Installer\WebInstallerPage\getVar
getVar( $var, $default=null)
Definition
WebInstallerPage.php:140
MediaWiki\Installer\WebInstallerPage\setVar
setVar( $name, $value)
Definition
WebInstallerPage.php:148
MediaWiki\Installer\WebInstallerPage\getId
getId()
Definition
WebInstallerPage.php:130
MediaWiki\Installer\WebInstallerPage\startLiveBox
startLiveBox()
Opens a textarea used to display the progress of a long operation.
Definition
WebInstallerPage.php:176
MediaWiki\Installer\WebInstallerPage\addHTML
addHTML( $html)
Definition
WebInstallerPage.php:51
MediaWiki\Installer\WebInstallerPage\isSlow
isSlow()
Is this a slow-running page in the installer?
Definition
WebInstallerPage.php:44
MediaWiki\Installer\WebInstallerPage\__construct
__construct(WebInstaller $parent)
Definition
WebInstallerPage.php:33
MediaWiki\Installer\WebInstallerPage\getName
getName()
Definition
WebInstallerPage.php:123
MediaWiki\Installer\WebInstallerPage\getFieldsetEnd
getFieldsetEnd()
Get the end tag of a fieldset.
Definition
WebInstallerPage.php:169
MediaWiki\Installer\WebInstallerPage\$parent
WebInstaller $parent
The WebInstaller object this WebInstallerPage belongs to.
Definition
WebInstallerPage.php:26
MediaWiki\Installer\WebInstallerPage\endLiveBox
endLiveBox()
Opposite to WebInstallerPage\startLiveBox.
Definition
WebInstallerPage.php:190
MediaWiki\Installer\WebInstallerPage\startForm
startForm()
Definition
WebInstallerPage.php:55
MediaWiki\Installer\WebInstaller
Class for the core installer web interface.
Definition
WebInstaller.php:33
includes
Installer
WebInstallerPage.php
Generated on
for MediaWiki by
1.18.0