MediaWiki master
WebInstallerUpgrade.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Installer;
23
25
29 public function isSlow() {
30 return true;
31 }
32
36 public function execute() {
37 if ( $this->getVar( '_UpgradeDone' ) ) {
38 // Allow regeneration of LocalSettings.php, unless we are working
39 // from a pre-existing LocalSettings.php file and we want to avoid
40 // leaking its contents
41 if ( $this->parent->request->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) {
42 // Done message acknowledged
43 return 'continue';
44 }
45 // Back button click
46 // Show the done message again
47 // Make them click back again if they want to do the upgrade again
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->addHTML(
91 $this->parent->getInfoBox(
92 wfMessage( $msg,
93 $this->getVar( 'wgServer' ) .
94 $this->getVar( 'wgScriptPath' ) . '/index.php'
95 )->plain()
96 )
97 );
98 $this->parent->restoreLinkPopups();
99 $this->endForm( $regenerate ? 'regenerate' : false, false );
100 }
101
102}
const MW_VERSION
The running version of MediaWiki.
Definition Defines.php:37
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.