MediaWiki master
WebInstallerUpgrade.php
Go to the documentation of this file.
1<?php
8namespace MediaWiki\Installer;
9
11
15 public function isSlow() {
16 return true;
17 }
18
22 public function execute() {
23 if ( $this->getVar( '_UpgradeDone' ) ) {
24 // Allow regeneration of LocalSettings.php, unless we are working
25 // from a pre-existing LocalSettings.php file and we want to avoid
26 // leaking its contents
27 if ( $this->parent->request->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) {
28 // Done message acknowledged
29 return 'continue';
30 }
31 // Back button click
32 // Show the done message again
33 // Make them click back again if they want to do the upgrade again
34 $this->showDoneMessage();
35
36 return 'output';
37 }
38
39 if ( !$this->parent->needsUpgrade() ) {
40 return 'skip';
41 }
42
43 if ( $this->parent->request->wasPosted() ) {
44 $this->startLiveBox();
45 $result = $this->parent->doUpgrade();
46 $this->endLiveBox();
47
48 if ( $result ) {
49 $this->showDoneMessage();
50 } else {
51 $this->startForm();
52 $this->parent->showError( 'config-upgrade-error' );
53 $this->endForm();
54 }
55
56 return 'output';
57 }
58
59 $this->startForm();
60 $this->addHTML( $this->parent->getInfoBox(
61 wfMessage( 'config-can-upgrade', MW_VERSION )->plain() ) );
62 $this->endForm();
63
64 return null;
65 }
66
67 public function showDoneMessage() {
68 $this->startForm();
69 $regenerate = !$this->getVar( '_ExistingDBSettings' );
70 if ( $regenerate ) {
71 $msg = 'config-upgrade-done';
72 } else {
73 $msg = 'config-upgrade-done-no-regenerate';
74 }
75 $this->parent->disableLinkPopups();
76 $this->parent->showSuccess(
77 $msg,
78 $this->getVar( 'wgServer' ) . $this->getVar( 'wgScriptPath' ) . '/index.php'
79 );
80 $this->parent->restoreLinkPopups();
81 $this->endForm( $regenerate ? 'regenerate' : false, false );
82 }
83
84}
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:23
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Abstract class to define pages for the web installer.
endForm( $continue='continue', $back='back')
startLiveBox()
Opens a textarea used to display the progress of a long operation.
endLiveBox()
Opposite to WebInstallerPage::startLiveBox.