3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
22 class WebInstallerUpgrade
extends WebInstallerPage
{
25 * @return bool Always true.
27 public function isSlow() {
34 public function execute() {
35 if ( $this->getVar( '_UpgradeDone' ) ) {
36 // Allow regeneration of LocalSettings.php, unless we are working
37 // from a pre-existing LocalSettings.php file and we want to avoid
38 // leaking its contents
39 if ( $this->parent
->request
->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) {
40 // Done message acknowledged
44 // Show the done message again
45 // Make them click back again if they want to do the upgrade again
46 $this->showDoneMessage();
52 // wgDBtype is generally valid here because otherwise the previous page
53 // (connect) wouldn't have declared its happiness
54 $type = $this->getVar( 'wgDBtype' );
55 $installer = $this->parent
->getDBInstaller( $type );
57 if ( !$installer->needsUpgrade() ) {
61 if ( $this->parent
->request
->wasPosted() ) {
62 $installer->preUpgrade();
64 $this->startLiveBox();
65 $result = $installer->doUpgrade();
69 // If they're going to possibly regenerate LocalSettings, we
70 // need to create the upgrade/secret keys. Bug 26481
71 if ( !$this->getVar( '_ExistingDBSettings' ) ) {
72 $this->parent
->generateKeys();
74 $this->setVar( '_UpgradeDone', true );
75 $this->showDoneMessage();
82 $this->addHTML( $this->parent
->getInfoBox(
83 wfMessage( 'config-can-upgrade', $GLOBALS['wgVersion'] )->plain() ) );
89 public function showDoneMessage() {
91 $regenerate = !$this->getVar( '_ExistingDBSettings' );
93 $msg = 'config-upgrade-done';
95 $msg = 'config-upgrade-done-no-regenerate';
97 $this->parent
->disableLinkPopups();
99 $this->parent
->getInfoBox(
101 $this->getVar( 'wgServer' ) .
102 $this->getVar( 'wgScriptPath' ) . '/index.php'
103 )->plain(), 'tick-32.png'
106 $this->parent
->restoreLinkPopups();
107 $this->endForm( $regenerate ?
'regenerate' : false, false );