Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / installer / WebInstallerInstall.php
blob05f5e1fb69c8d1ffe8306816372c577adaebec36
1 <?php
3 /**
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * http://www.gnu.org/copyleft/gpl.html
19 * @file
20 * @ingroup Installer
23 namespace MediaWiki\Installer;
25 use MediaWiki\Installer\Task\Task;
26 use MediaWiki\Status\Status;
28 class WebInstallerInstall extends WebInstallerPage {
30 /**
31 * @return bool Always true.
33 public function isSlow() {
34 return true;
37 /**
38 * @return string|bool
40 public function execute() {
41 if ( $this->getVar( '_UpgradeDone' ) ) {
42 return 'skip';
43 } elseif ( $this->getVar( '_InstallDone' ) ) {
44 return 'continue';
45 } elseif ( $this->parent->request->wasPosted() ) {
46 $this->startForm();
47 $this->addHTML( "<ul>" );
48 $status = $this->parent->performInstallation(
49 [ $this, 'startStage' ],
50 [ $this, 'endStage' ]
52 $this->addHTML( "</ul>" );
53 $continue = $status->isOK() ? 'continue' : false;
54 $back = $status->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();
62 return true;
65 /**
66 * @param Task $task
68 public function startStage( $task ) {
69 $this->addHTML( "<li>" . $task->getDescriptionMessage()->escaped() .
70 wfMessage( 'ellipsis' )->escaped() );
72 if ( $task->getName() == 'extension-tables' ) {
73 $this->startLiveBox();
77 /**
78 * @param Task $task
79 * @param Status $status
81 public function endStage( $task, $status ) {
82 if ( $task->getName() == 'extension-tables' ) {
83 $this->endLiveBox();
85 $msg = $status->isOK() ? 'config-install-step-done' : 'config-install-step-failed';
86 $html = wfMessage( 'word-separator' )->escaped() . wfMessage( $msg )->escaped();
87 if ( !$status->isOK() ) {
88 $html = "<span class=\"error\">$html</span>";
90 $this->addHTML( $html . "</li>\n" );
91 if ( !$status->isGood() ) {
92 $this->parent->showStatusBox( $status );