MediaWiki master
WebInstallerInstall.php
Go to the documentation of this file.
1<?php
2
23namespace MediaWiki\Installer;
24
26
28
32 public function isSlow() {
33 return true;
34 }
35
39 public function execute() {
40 if ( $this->getVar( '_UpgradeDone' ) ) {
41 return 'skip';
42 } elseif ( $this->getVar( '_InstallDone' ) ) {
43 return 'continue';
44 } elseif ( $this->parent->request->wasPosted() ) {
45 $this->startForm();
46 $this->addHTML( "<ul>" );
47 $results = $this->parent->performInstallation(
48 [ $this, 'startStage' ],
49 [ $this, 'endStage' ]
50 );
51 $this->addHTML( "</ul>" );
52 // PerformInstallation bails on a fatal, so make sure the last item
53 // completed before giving 'next.' Likewise, only provide back on failure
54 $lastStep = end( $results );
55 $continue = $lastStep->isOK() ? 'continue' : false;
56 $back = $lastStep->isOK() ? false : 'back';
57 $this->endForm( $continue, $back );
58 } else {
59 $this->startForm();
60 $this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-install-begin' )->plain() ) );
61 $this->endForm();
62 }
63
64 return true;
65 }
66
70 public function startStage( $step ) {
71 // Messages: config-install-database, config-install-tables, config-install-interwiki,
72 // config-install-stats, config-install-keys, config-install-sysop, config-install-mainpage
73 $this->addHTML( "<li>" . wfMessage( "config-install-$step" )->escaped() .
74 wfMessage( 'ellipsis' )->escaped() );
75
76 if ( $step == 'extension-tables' ) {
77 $this->startLiveBox();
78 }
79 }
80
85 public function endStage( $step, $status ) {
86 if ( $step == 'extension-tables' ) {
87 $this->endLiveBox();
88 }
89 $msg = $status->isOK() ? 'config-install-step-done' : 'config-install-step-failed';
90 $html = wfMessage( 'word-separator' )->escaped() . wfMessage( $msg )->escaped();
91 if ( !$status->isOK() ) {
92 $html = "<span class=\"error\">$html</span>";
93 }
94 $this->addHTML( $html . "</li>\n" );
95 if ( !$status->isGood() ) {
96 $this->parent->showStatusBox( $status );
97 }
98 }
99
100}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Abstract class to define pages for the web installer.
endForm( $continue='continue', $back='back')
startLiveBox()
Opens a textarea used to display the progress of a long operation.
endLiveBox()
Opposite to WebInstallerPage::startLiveBox.
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54