MediaWiki REL1_34
WebInstallerPage.php
Go to the documentation of this file.
1<?php
30abstract class WebInstallerPage {
31
37 public $parent;
38
42 abstract public function execute();
43
47 public function __construct( WebInstaller $parent ) {
48 $this->parent = $parent;
49 }
50
58 public function isSlow() {
59 return false;
60 }
61
65 public function addHTML( $html ) {
66 $this->parent->output->addHTML( $html );
67 }
68
69 public function startForm() {
70 $this->addHTML(
71 "<div class=\"config-section\">\n" .
72 Html::openElement(
73 'form',
74 [
75 'method' => 'post',
76 'action' => $this->parent->getUrl( [ 'page' => $this->getName() ] )
77 ]
78 ) . "\n"
79 );
80 }
81
86 public function endForm( $continue = 'continue', $back = 'back' ) {
87 $s = "<div class=\"config-submit\">\n";
88 $id = $this->getId();
89
90 if ( $id === false ) {
91 $s .= Html::hidden( 'lastPage', $this->parent->request->getVal( 'lastPage' ) );
92 }
93
94 if ( $continue ) {
95 // Fake submit button for enter keypress (T28267)
96 // Messages: config-continue, config-restart, config-regenerate
97 $s .= Xml::submitButton(
98 wfMessage( "config-$continue" )->text(),
99 [
100 'name' => "enter-$continue",
101 'style' => 'width:0;border:0;height:0;padding:0'
102 ]
103 ) . "\n";
104 }
105
106 if ( $back ) {
107 // Message: config-back
108 $s .= Xml::submitButton(
109 wfMessage( "config-$back" )->text(),
110 [
111 'name' => "submit-$back",
112 'tabindex' => $this->parent->nextTabIndex()
113 ]
114 ) . "\n";
115 }
116
117 if ( $continue ) {
118 // Messages: config-continue, config-restart, config-regenerate
119 $s .= Xml::submitButton(
120 wfMessage( "config-$continue" )->text(),
121 [
122 'name' => "submit-$continue",
123 'tabindex' => $this->parent->nextTabIndex(),
124 ]
125 ) . "\n";
126 }
127
128 $s .= "</div></form></div>\n";
129 $this->addHTML( $s );
130 }
131
135 public function getName() {
136 return str_replace( 'WebInstaller', '', static::class );
137 }
138
142 protected function getId() {
143 return array_search( $this->getName(), $this->parent->pageSequence );
144 }
145
152 public function getVar( $var, $default = null ) {
153 return $this->parent->getVar( $var, $default );
154 }
155
160 public function setVar( $name, $value ) {
161 $this->parent->setVar( $name, $value );
162 }
163
171 protected function getFieldsetStart( $legend ) {
172 return "\n<fieldset><legend>" . wfMessage( $legend )->escaped() . "</legend>\n";
173 }
174
180 protected function getFieldsetEnd() {
181 return "</fieldset>\n";
182 }
183
187 protected function startLiveBox() {
188 $this->addHTML(
189 '<div id="config-spinner" style="display:none;">' .
190 '<img src="images/ajax-loader.gif" /></div>' .
191 '<script>jQuery( "#config-spinner" ).show();</script>' .
192 '<div id="config-live-log">' .
193 '<textarea name="LiveLog" rows="10" cols="30" readonly="readonly">'
194 );
195 $this->parent->output->flush();
196 }
197
201 protected function endLiveBox() {
202 $this->addHTML( '</textarea></div>
203<script>jQuery( "#config-spinner" ).hide()</script>' );
204 $this->parent->output->flush();
205 }
206
207}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Abstract class to define pages for the web installer.
WebInstaller $parent
The WebInstaller object this WebInstallerPage belongs to.
getFieldsetEnd()
Get the end tag of a fieldset.
setVar( $name, $value)
endForm( $continue='continue', $back='back')
getVar( $var, $default=null)
startLiveBox()
Opens a textarea used to display the progress of a long operation.
__construct(WebInstaller $parent)
getFieldsetStart( $legend)
Get the starting tags of a fieldset.
endLiveBox()
Opposite to WebInstallerPage::startLiveBox.
isSlow()
Is this a slow-running page in the installer? If so, WebInstaller will set_time_limit(0) before calli...
Class for the core installer web interface.