| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
namespace MediaWiki\Installer; |
| 24 |
|
| 25 |
use MediaWiki\Status\Status; |
| 26 |
|
| 27 |
class WebInstallerInstall extends WebInstallerPage { |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public function isSlow() { |
| 33 |
return true; |
| 34 |
} |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public function execute() { |
| 40 |
if ( $this->getVar( '_UpgradeDone' ) ) { |
| 41 |
return 'skip'; |
| 42 |
} elseif ( $this->getVar( '_InstallDone' ) ) { |
| 43 |
return 'continue'; |
| 44 |
} elseif ( $this->parent->request->wasPosted() ) { |
| 45 |
$this->startForm(); |
| 46 |
$this->addHTML( "<ul>" ); |
| 47 |
$results = $this->parent->performInstallation( |
| 48 |
[ $this, 'startStage' ], |
| 49 |
[ $this, 'endStage' ] |
| 50 |
); |
| 51 |
$this->addHTML( "</ul>" ); |
| 52 |
|
| 53 |
|
| 54 |
$lastStep = end( $results ); |
| 55 |
$continue = $lastStep->isOK() ? 'continue' : false; |
| 56 |
$back = $lastStep->isOK() ? false : 'back'; |
| 57 |
$this->endForm( $continue, $back ); |
| 58 |
} else { |
| 59 |
$this->startForm(); |
| 60 |
$this->addHTML( $this->parent->getInfoBox( wfMessage( 'config-install-begin' )->plain() ) ); |
| 61 |
$this->endForm(); |
| 62 |
} |
| 63 |
|
| 64 |
return true; |
| 65 |
} |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
public function startStage( $step ) { |
| 71 |
|
| 72 |
|
| 73 |
$this->addHTML( "<li>" . wfMessage( "config-install-$step" )->escaped() . |
| 74 |
wfMessage( 'ellipsis' )->escaped() ); |
| 75 |
|
| 76 |
if ( $step == 'extension-tables' ) { |
| 77 |
$this->startLiveBox(); |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
public function endStage( $step, $status ) { |
| 86 |
if ( $step == 'extension-tables' ) { |
| 87 |
$this->endLiveBox(); |
| 88 |
} |
| 89 |
$msg = $status->isOK() ? 'config-install-step-done' : 'config-install-step-failed'; |
| 90 |
$html = wfMessage( 'word-separator' )->escaped() . wfMessage( $msg )->escaped(); |
| 91 |
if ( !$status->isOK() ) { |
| 92 |
$html = "<span class=\"error\">$html</span>"; |
| 93 |
} |
| 94 |
$this->addHTML( $html . "</li>\n" ); |
| 95 |
if ( !$status->isGood() ) { |
| 96 |
$this->parent->showStatusBox( $status ); |
| 97 |
} |
| 98 |
} |
| 99 |
|
| 100 |
} |