Localisation updates from https://translatewiki.net.
[mediawiki.git] / includes / installer / WebInstallerUpgrade.php
blobf2cc4412a7efbc0784973e4eef9efc4b7a6a8d20
1 <?php
2 /**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
18 * @file
19 * @ingroup Installer
22 namespace MediaWiki\Installer;
24 class WebInstallerUpgrade extends WebInstallerPage {
26 /**
27 * @return bool Always true.
29 public function isSlow() {
30 return true;
33 /**
34 * @return string|null
36 public function execute() {
37 if ( $this->getVar( '_UpgradeDone' ) ) {
38 // Allow regeneration of LocalSettings.php, unless we are working
39 // from a pre-existing LocalSettings.php file and we want to avoid
40 // leaking its contents
41 if ( $this->parent->request->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) {
42 // Done message acknowledged
43 return 'continue';
45 // Back button click
46 // Show the done message again
47 // Make them click back again if they want to do the upgrade again
48 $this->showDoneMessage();
50 return 'output';
53 if ( !$this->parent->needsUpgrade() ) {
54 return 'skip';
57 if ( $this->parent->request->wasPosted() ) {
58 $this->startLiveBox();
59 $result = $this->parent->doUpgrade();
60 $this->endLiveBox();
62 if ( $result ) {
63 $this->showDoneMessage();
64 } else {
65 $this->startForm();
66 $this->parent->showError( 'config-upgrade-error' );
67 $this->endForm();
70 return 'output';
73 $this->startForm();
74 $this->addHTML( $this->parent->getInfoBox(
75 wfMessage( 'config-can-upgrade', MW_VERSION )->plain() ) );
76 $this->endForm();
78 return null;
81 public function showDoneMessage() {
82 $this->startForm();
83 $regenerate = !$this->getVar( '_ExistingDBSettings' );
84 if ( $regenerate ) {
85 $msg = 'config-upgrade-done';
86 } else {
87 $msg = 'config-upgrade-done-no-regenerate';
89 $this->parent->disableLinkPopups();
90 $this->addHTML(
91 $this->parent->getInfoBox(
92 wfMessage( $msg,
93 $this->getVar( 'wgServer' ) .
94 $this->getVar( 'wgScriptPath' ) . '/index.php'
95 )->plain(), 'tick-32.png'
98 $this->parent->restoreLinkPopups();
99 $this->endForm( $regenerate ? 'regenerate' : false, false );