MediaWiki REL1_31
WebInstallerUpgrade.php
Go to the documentation of this file.
1<?php
23
27 public function isSlow() {
28 return true;
29 }
30
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
41 return 'continue';
42 } else {
43 // Back button click
44 // Show the done message again
45 // Make them click back again if they want to do the upgrade again
46 $this->showDoneMessage();
47
48 return 'output';
49 }
50 }
51
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 );
56
57 if ( !$installer->needsUpgrade() ) {
58 return 'skip';
59 }
60
61 if ( $this->parent->request->wasPosted() ) {
62 $installer->preUpgrade();
63
64 $this->startLiveBox();
65 $result = $installer->doUpgrade();
66 $this->endLiveBox();
67
68 if ( $result ) {
69 // If they're going to possibly regenerate LocalSettings, we
70 // need to create the upgrade/secret keys. T28481
71 if ( !$this->getVar( '_ExistingDBSettings' ) ) {
72 $this->parent->generateKeys();
73 }
74 $this->setVar( '_UpgradeDone', true );
75 $this->showDoneMessage();
76
77 return 'output';
78 }
79 }
80
81 $this->startForm();
82 $this->addHTML( $this->parent->getInfoBox(
83 wfMessage( 'config-can-upgrade', $GLOBALS['wgVersion'] )->plain() ) );
84 $this->endForm();
85
86 return null;
87 }
88
89 public function showDoneMessage() {
90 $this->startForm();
91 $regenerate = !$this->getVar( '_ExistingDBSettings' );
92 if ( $regenerate ) {
93 $msg = 'config-upgrade-done';
94 } else {
95 $msg = 'config-upgrade-done-no-regenerate';
96 }
97 $this->parent->disableLinkPopups();
98 $this->addHTML(
99 $this->parent->getInfoBox(
100 wfMessage( $msg,
101 $this->getVar( 'wgServer' ) .
102 $this->getVar( 'wgScriptPath' ) . '/index.php'
103 )->plain(), 'tick-32.png'
104 )
105 );
106 $this->parent->restoreLinkPopups();
107 $this->endForm( $regenerate ? 'regenerate' : false, false );
108 }
109
110}
$GLOBALS['IP']
Abstract class to define pages for the web installer.
setVar( $name, $value)
endForm( $continue='continue', $back='back')
getVar( $var, $default=null)
startLiveBox()
Opens a textarea used to display the progress of a long operation.
endLiveBox()
Opposite to WebInstallerPage::startLiveBox.
either a plain
Definition hooks.txt:2056
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock() - offset Set to overwrite offset parameter in $wgRequest set to '' to unset offset - wrap String Wrap the message in html(usually something like "&lt;div ...>$1&lt;/div>"). - flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException':Called before an exception(or PHP error) is logged. This is meant for integration with external error aggregation services
processing should stop and the error should be shown to the user * false
Definition hooks.txt:187