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