Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 33 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
WebInstallerInstall | |
0.00% |
0 / 33 |
|
0.00% |
0 / 4 |
210 | |
0.00% |
0 / 1 |
isSlow | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 19 |
|
0.00% |
0 / 1 |
42 | |||
startStage | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
endStage | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
30 |
1 | <?php |
2 | |
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. |
8 | * |
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. |
13 | * |
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 |
18 | * |
19 | * @file |
20 | * @ingroup Installer |
21 | */ |
22 | |
23 | namespace MediaWiki\Installer; |
24 | |
25 | use MediaWiki\Installer\Task\Task; |
26 | use MediaWiki\Status\Status; |
27 | |
28 | class WebInstallerInstall extends WebInstallerPage { |
29 | |
30 | /** |
31 | * @return bool Always true. |
32 | */ |
33 | public function isSlow() { |
34 | return true; |
35 | } |
36 | |
37 | /** |
38 | * @return string|bool |
39 | */ |
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' ] |
51 | ); |
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(); |
60 | } |
61 | |
62 | return true; |
63 | } |
64 | |
65 | /** |
66 | * @param Task $task |
67 | */ |
68 | public function startStage( $task ) { |
69 | $this->addHTML( "<li>" . $task->getDescriptionMessage()->escaped() . |
70 | wfMessage( 'ellipsis' )->escaped() ); |
71 | |
72 | if ( $task->getName() == 'extension-tables' ) { |
73 | $this->startLiveBox(); |
74 | } |
75 | } |
76 | |
77 | /** |
78 | * @param Task $task |
79 | * @param Status $status |
80 | */ |
81 | public function endStage( $task, $status ) { |
82 | if ( $task->getName() == 'extension-tables' ) { |
83 | $this->endLiveBox(); |
84 | } |
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>"; |
89 | } |
90 | $this->addHTML( $html . "</li>\n" ); |
91 | if ( !$status->isGood() ) { |
92 | $this->parent->showStatusBox( $status ); |
93 | } |
94 | } |
95 | |
96 | } |