| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
namespace MediaWiki\Installer; |
| 23 |
|
| 24 |
class WebInstallerUpgrade extends WebInstallerPage { |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public function isSlow() { |
| 30 |
return true; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public function execute() { |
| 37 |
if ( $this->getVar( '_UpgradeDone' ) ) { |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
if ( $this->parent->request->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) { |
| 42 |
|
| 43 |
return 'continue'; |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
$this->showDoneMessage(); |
| 49 |
|
| 50 |
return 'output'; |
| 51 |
} |
| 52 |
|
| 53 |
if ( !$this->parent->needsUpgrade() ) { |
| 54 |
return 'skip'; |
| 55 |
} |
| 56 |
|
| 57 |
if ( $this->parent->request->wasPosted() ) { |
| 58 |
$this->startLiveBox(); |
| 59 |
$result = $this->parent->doUpgrade(); |
| 60 |
$this->endLiveBox(); |
| 61 |
|
| 62 |
if ( $result ) { |
| 63 |
$this->showDoneMessage(); |
| 64 |
} else { |
| 65 |
$this->startForm(); |
| 66 |
$this->parent->showError( 'config-upgrade-error' ); |
| 67 |
$this->endForm(); |
| 68 |
} |
| 69 |
|
| 70 |
return 'output'; |
| 71 |
} |
| 72 |
|
| 73 |
$this->startForm(); |
| 74 |
$this->addHTML( $this->parent->getInfoBox( |
| 75 |
wfMessage( 'config-can-upgrade', MW_VERSION )->plain() ) ); |
| 76 |
$this->endForm(); |
| 77 |
|
| 78 |
return null; |
| 79 |
} |
| 80 |
|
| 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'; |
| 88 |
} |
| 89 |
$this->parent->disableLinkPopups(); |
| 90 |
$this->parent->showSuccess( |
| 91 |
$msg, |
| 92 |
$this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/index.php' |
| 93 |
); |
| 94 |
$this->parent->restoreLinkPopups(); |
| 95 |
$this->endForm( $regenerate ? 'regenerate' : false, false ); |
| 96 |
} |
| 97 |
|
| 98 |
} |