MediaWiki  1.34.4
WebInstallerPage.php
Go to the documentation of this file.
1 <?php
30 abstract 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" .
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
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
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
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 }
WebInstallerPage\startForm
startForm()
Definition: WebInstallerPage.php:69
WebInstallerPage\getFieldsetStart
getFieldsetStart( $legend)
Get the starting tags of a fieldset.
Definition: WebInstallerPage.php:171
WebInstaller
Class for the core installer web interface.
Definition: WebInstaller.php:32
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1263
$s
$s
Definition: mergeMessageFileList.php:185
WebInstallerPage\endForm
endForm( $continue='continue', $back='back')
Definition: WebInstallerPage.php:86
WebInstallerPage\$parent
WebInstaller $parent
The WebInstaller object this WebInstallerPage belongs to.
Definition: WebInstallerPage.php:37
WebInstallerPage\__construct
__construct(WebInstaller $parent)
Definition: WebInstallerPage.php:47
WebInstallerPage\endLiveBox
endLiveBox()
Opposite to WebInstallerPage::startLiveBox.
Definition: WebInstallerPage.php:201
WebInstallerPage\getVar
getVar( $var, $default=null)
Definition: WebInstallerPage.php:152
WebInstallerPage\getFieldsetEnd
getFieldsetEnd()
Get the end tag of a fieldset.
Definition: WebInstallerPage.php:180
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:802
WebInstallerPage\getName
getName()
Definition: WebInstallerPage.php:135
WebInstallerPage\addHTML
addHTML( $html)
Definition: WebInstallerPage.php:65
WebInstallerPage\getId
getId()
Definition: WebInstallerPage.php:142
WebInstallerPage\execute
execute()
WebInstallerPage\setVar
setVar( $name, $value)
Definition: WebInstallerPage.php:160
WebInstallerPage
Abstract class to define pages for the web installer.
Definition: WebInstallerPage.php:30
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:251
WebInstallerPage\startLiveBox
startLiveBox()
Opens a textarea used to display the progress of a long operation.
Definition: WebInstallerPage.php:187
WebInstallerPage\isSlow
isSlow()
Is this a slow-running page in the installer? If so, WebInstaller will set_time_limit(0) before calli...
Definition: WebInstallerPage.php:58
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:459