r72553 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72552‎ | r72553 | r72554 >
Date:20:57, 7 September 2010
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
Per ^demon's comment on r71430: moved doUpgrade() to DatabaseInstaller (did not remove the stub method in Oracle installer)
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/PostgresInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/SqliteInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/SqliteInstaller.php
@@ -170,16 +170,6 @@
171171 return $status;
172172 }
173173
174 - public function doUpgrade() {
175 - LBFactory::enableBackend();
176 - $db = wfGetDB( DB_MASTER );
177 - ob_start( array( $this, 'outputHandler' ) );
178 - $updater = DatabaseUpdater::newForDb( $this->db );
179 - $updater->doUpdates();
180 - ob_end_flush();
181 - return true;
182 - }
183 -
184174 public function getLocalSettings() {
185175 $dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
186176 return
Index: trunk/phase3/includes/installer/DatabaseInstaller.php
@@ -141,14 +141,30 @@
142142 *
143143 * @return String
144144 */
145 - public abstract function getLocalSettings();
 145+ public abstract function getLocalSettings();
146146
147147 /**
148148 * Perform database upgrades
149149 *
150150 * @return Boolean
151151 */
152 - public abstract function doUpgrade();
 152+ public function doUpgrade() {
 153+ # Maintenance scripts like wfGetDB()
 154+ LBFactory::enableBackend();
 155+
 156+ $ret = true;
 157+ ob_start( array( __CLASS__, 'outputHandler' ) );
 158+ try {
 159+ $up = DatabaseUpdater::newForDB( $this->db );
 160+ $up->execute();
 161+ } catch ( MWException $e ) {
 162+ echo "\nAn error occured:\n";
 163+ echo $e->getText();
 164+ $ret = false;
 165+ }
 166+ ob_end_flush();
 167+ return $ret;
 168+ }
153169
154170 /**
155171 * Allow DB installers a chance to make last-minute changes before installation
Index: trunk/phase3/includes/installer/MysqlInstaller.php
@@ -131,6 +131,8 @@
132132 }
133133
134134 public function preUpgrade() {
 135+ global $wgDBuser, $wgDBpassword;
 136+
135137 $status = $this->getConnection();
136138 if ( !$status->isOK() ) {
137139 $this->parent->showStatusError( $status );
@@ -178,35 +180,11 @@
179181 $this->parent->showMessage( 'config-mysql-egine-mismatch', $this->getVar( '_MysqlEngine' ), $existingEngine );
180182 $this->setVar( '_MysqlEngine', $existingEngine );
181183 }
182 - }
183184
184 - /**
185 - * @todo FIXME: this code is just pure crap for compatibility between
186 - * old and new code.
187 - */
188 - public function doUpgrade() {
189 - global $wgDBuser, $wgDBpassword;
190 -
191 - # Some maintenance scripts like wfGetDB()
192 - LBFactory::enableBackend();
193185 # Normal user and password are selected after this step, so for now
194186 # just copy these two
195187 $wgDBuser = $this->getVar( '_InstallUser' );
196188 $wgDBpassword = $this->getVar( '_InstallPassword' );
197 -
198 - $ret = true;
199 -
200 - ob_start( array( $this, 'outputHandler' ) );
201 - try {
202 - $updater = DatabaseUpdater::newForDb( $this->db );
203 - $updater->doUpdates();
204 - } catch ( MWException $e ) {
205 - echo "\nAn error occured:\n";
206 - echo $e->getText();
207 - $ret = false;
208 - }
209 - ob_end_flush();
210 - return $ret;
211189 }
212190
213191 /**
Index: trunk/phase3/includes/installer/PostgresInstaller.php
@@ -126,8 +126,12 @@
127127 \$wgDBts2schema = \"{$ts2}\";";
128128 }
129129
130 - public function doUpgrade() {
131 - // TODO
132 - return false;
 130+ public function preUpgrade() {
 131+ global $wgDBuser, $wgDBpassword;
 132+
 133+ # Normal user and password are selected after this step, so for now
 134+ # just copy these two
 135+ $wgDBuser = $this->getVar( '_InstallUser' );
 136+ $wgDBpassword = $this->getVar( '_InstallPassword' );
133137 }
134138 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r74105Fix for r72553: DatabaseUpdater::execute() doesn't exist...ialex20:39, 1 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r71430* Make the MySQL updater work in the new installer...ialex10:37, 22 August 2010

Comments

#Comment by Brion VIBBER (talk | contribs)   20:20, 3 October 2010

r74105 fixes a fatal here.

Status & tagging log