MediaWiki  1.30.0
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 }
text
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
Definition: design.txt:12
WebInstaller
Class for the core installer web interface.
Definition: WebInstaller.php:30
$s
$s
Definition: mergeMessageFileList.php:188
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$html
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses & $html
Definition: hooks.txt:1965
execute
$batch execute()
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:725
$value
$value
Definition: styleTest.css.php:45
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
wfMessage
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:459