Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 1
WebInstallerInstall
0.00% covered (danger)
0.00%
0 / 33
0.00% covered (danger)
0.00%
0 / 4
210
0.00% covered (danger)
0.00%
0 / 1
 isSlow
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 execute
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 1
42
 startStage
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
6
 endStage
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
30
1<?php
2
3/**
4 * @license GPL-2.0-or-later
5 * @file
6 * @ingroup Installer
7 */
8
9namespace MediaWiki\Installer;
10
11use MediaWiki\Installer\Task\Task;
12use MediaWiki\Status\Status;
13
14class WebInstallerInstall extends WebInstallerPage {
15
16    /**
17     * @return bool Always true.
18     */
19    public function isSlow() {
20        return true;
21    }
22
23    /**
24     * @return string|bool
25     */
26    public function execute() {
27        if ( $this->getVar( '_UpgradeDone' ) ) {
28            return 'skip';
29        } elseif ( $this->getVar( '_InstallDone' ) ) {
30            return 'continue';
31        } elseif ( $this->parent->request->wasPosted() ) {
32            $this->startForm();
33            $this->addHTML( "<ul>" );
34            $status = $this->parent->performInstallation(
35                $this->startStage( ... ),
36                $this->endStage( ... )
37            );
38            $this->addHTML( "</ul>" );
39            $continue = $status->isOK() ? 'continue' : false;
40            $back = $status->isOK() ? false : 'back';
41            $this->endForm( $continue, $back );
42        } else {
43            $this->startForm();
44            $this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-install-begin' )->plain() ) );
45            $this->endForm();
46        }
47
48        return true;
49    }
50
51    /**
52     * @param Task $task
53     */
54    public function startStage( $task ) {
55        $this->addHTML( "<li>" . $task->getDescriptionMessage()->escaped() .
56            wfMessage( 'ellipsis' )->escaped() );
57
58        if ( $task->getName() == 'extension-tables' ) {
59            $this->startLiveBox();
60        }
61    }
62
63    /**
64     * @param Task $task
65     * @param Status $status
66     */
67    public function endStage( $task, $status ) {
68        if ( $task->getName() == 'extension-tables' ) {
69            $this->endLiveBox();
70        }
71        $msg = $status->isOK() ? 'config-install-step-done' : 'config-install-step-failed';
72        $html = wfMessage( 'word-separator' )->escaped() . wfMessage( $msg )->escaped();
73        if ( !$status->isOK() ) {
74            $html = "<span class=\"error\">$html</span>";
75        }
76        $this->addHTML( $html . "</li>\n" );
77        if ( !$status->isGood() ) {
78            $this->parent->showStatusBox( $status );
79        }
80    }
81
82}