MediaWiki master
WebInstallerPage.php
Go to the documentation of this file.
1<?php
2
23namespace MediaWiki\Installer;
24
27
34abstract class WebInstallerPage {
35
41 public $parent;
42
46 abstract public function execute();
47
48 public function __construct( WebInstaller $parent ) {
49 $this->parent = $parent;
50 }
51
59 public function isSlow() {
60 return false;
61 }
62
66 public function addHTML( $html ) {
67 $this->parent->output->addHTML( $html );
68 }
69
70 public function startForm() {
71 $this->addHTML(
72 "<div class=\"config-section\">\n" .
73 Html::openElement(
74 'form',
75 [
76 'method' => 'post',
77 'action' => $this->parent->getUrl( [ 'page' => $this->getName() ] )
78 ]
79 ) . "\n"
80 );
81 }
82
87 public function endForm( $continue = 'continue', $back = 'back' ) {
88 $s = "<div class=\"config-submit\">\n";
89 $id = $this->getId();
90
91 if ( $id === false ) {
92 $s .= Html::hidden( 'lastPage', $this->parent->request->getVal( 'lastPage' ) );
93 }
94
95 if ( $continue ) {
96 // Fake submit button for enter keypress (T28267)
97 // Messages: config-continue, config-restart, config-regenerate
99 wfMessage( "config-$continue" )->text(),
100 [
101 'name' => "enter-$continue",
102 'style' => 'width:0;border:0;height:0;padding:0'
103 ]
104 ) . "\n";
105 }
106
107 if ( $back ) {
108 // Message: config-back
109 $s .= Xml::submitButton(
110 wfMessage( "config-$back" )->text(),
111 [
112 'name' => "submit-$back",
113 'tabindex' => $this->parent->nextTabIndex(),
114 'class' => 'cdx-button cdx-button--action-default'
115 ]
116 ) . "\n";
117 }
118
119 if ( $continue ) {
120 // Messages: config-continue, config-restart, config-regenerate
121 $s .= Xml::submitButton(
122 wfMessage( "config-$continue" )->text(),
123 [
124 'name' => "submit-$continue",
125 'tabindex' => $this->parent->nextTabIndex(),
126 'class' => 'cdx-button cdx-button--action-progressive'
127 ]
128 ) . "\n";
129 }
130
131 $s .= "</div></form></div>\n";
132 $this->addHTML( $s );
133 }
134
138 public function getName() {
139 return str_replace( 'MediaWiki\\Installer\\WebInstaller', '', static::class );
140 }
141
145 protected function getId() {
146 return array_search( $this->getName(), $this->parent->pageSequence );
147 }
148
155 public function getVar( $var, $default = null ) {
156 return $this->parent->getVar( $var, $default );
157 }
158
163 public function setVar( $name, $value ) {
164 $this->parent->setVar( $name, $value );
165 }
166
174 protected function getFieldsetStart( $legend ) {
175 return "\n<div class=\"cdx-card\"><div class=\"cdx-card__text\"><div class=\"cdx-card__text__title\">" .
176 wfMessage( $legend )->escaped() . "</div><div class=\"cdx-card__text__description\">\n";
177 }
178
184 protected function getFieldsetEnd() {
185 return "</div></div></div>\n";
186 }
187
191 protected function startLiveBox() {
192 $this->addHTML(
193 '<div id="config-spinner" style="display:none;">' .
194 '<img src="images/ajax-loader.gif" /></div>' .
195 '<script>jQuery( "#config-spinner" ).show();</script>' .
196 '<div id="config-live-log">' .
197 '<textarea name="LiveLog" rows="10" cols="30" readonly="readonly">'
198 );
199 $this->parent->output->flush();
200 }
201
205 protected function endLiveBox() {
206 $this->addHTML( '</textarea></div>
207<script>jQuery( "#config-spinner" ).hide()</script>' );
208 $this->parent->output->flush();
209 }
210
211}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This class is a collection of static functions that serve two purposes:
Definition Html.php:56
static submitButton( $contents, array $attrs=[], array $modifiers=[])
Returns an HTML input element in a string.
Definition Html.php:163
Abstract class to define pages for the web installer.
getFieldsetStart( $legend)
Get the starting tags of a fieldset.
endForm( $continue='continue', $back='back')
startLiveBox()
Opens a textarea used to display the progress of a long operation.
isSlow()
Is this a slow-running page in the installer? If so, WebInstaller will set_time_limit(0) before calli...
getFieldsetEnd()
Get the end tag of a fieldset.
WebInstaller $parent
The WebInstaller object this WebInstallerPage belongs to.
endLiveBox()
Opposite to WebInstallerPage::startLiveBox.
Class for the core installer web interface.
Module of static functions for generating XML.
Definition Xml.php:37