MessageCache invalidation improvements
[mediawiki.git] / includes / installer / WebInstallerInstall.php
blob63740e3824c3e9e6de097042e7714c6c4d9d7d83
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 Deployment
22 class WebInstallerInstall extends WebInstallerPage {
24 /**
25 * @return bool Always true.
27 public function isSlow() {
28 return true;
31 /**
32 * @return string|bool
34 public function execute() {
35 if ( $this->getVar( '_UpgradeDone' ) ) {
36 return 'skip';
37 } elseif ( $this->getVar( '_InstallDone' ) ) {
38 return 'continue';
39 } elseif ( $this->parent->request->wasPosted() ) {
40 $this->startForm();
41 $this->addHTML( "<ul>" );
42 $results = $this->parent->performInstallation(
43 [ $this, 'startStage' ],
44 [ $this, 'endStage' ]
46 $this->addHTML( "</ul>" );
47 // PerformInstallation bails on a fatal, so make sure the last item
48 // completed before giving 'next.' Likewise, only provide back on failure
49 $lastStep = end( $results );
50 $continue = $lastStep->isOK() ? 'continue' : false;
51 $back = $lastStep->isOK() ? false : 'back';
52 $this->endForm( $continue, $back );
53 } else {
54 $this->startForm();
55 $this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-install-begin' )->plain() ) );
56 $this->endForm();
59 return true;
62 /**
63 * @param string $step
65 public function startStage( $step ) {
66 // Messages: config-install-database, config-install-tables, config-install-interwiki,
67 // config-install-stats, config-install-keys, config-install-sysop, config-install-mainpage
68 $this->addHTML( "<li>" . wfMessage( "config-install-$step" )->escaped() .
69 wfMessage( 'ellipsis' )->escaped() );
71 if ( $step == 'extension-tables' ) {
72 $this->startLiveBox();
76 /**
77 * @param string $step
78 * @param Status $status
80 public function endStage( $step, $status ) {
81 if ( $step == 'extension-tables' ) {
82 $this->endLiveBox();
84 $msg = $status->isOK() ? 'config-install-step-done' : 'config-install-step-failed';
85 $html = wfMessage( 'word-separator' )->escaped() . wfMessage( $msg )->escaped();
86 if ( !$status->isOK() ) {
87 $html = "<span class=\"error\">$html</span>";
89 $this->addHTML( $html . "</li>\n" );
90 if ( !$status->isGood() ) {
91 $this->parent->showStatusBox( $status );