*
* @return String
*/
- public abstract function getLocalSettings();
+ public abstract function getLocalSettings();
/**
* Perform database upgrades
*
* @return Boolean
*/
- public abstract function doUpgrade();
+ public function doUpgrade() {
+ # Maintenance scripts like wfGetDB()
+ LBFactory::enableBackend();
+
+ $ret = true;
+ ob_start( array( __CLASS__, 'outputHandler' ) );
+ try {
+ $up = DatabaseUpdater::newForDB( $this->db );
+ $up->execute();
+ } catch ( MWException $e ) {
+ echo "\nAn error occured:\n";
+ echo $e->getText();
+ $ret = false;
+ }
+ ob_end_flush();
+ return $ret;
+ }
/**
* Allow DB installers a chance to make last-minute changes before installation
}
public function preUpgrade() {
+ global $wgDBuser, $wgDBpassword;
+
$status = $this->getConnection();
if ( !$status->isOK() ) {
$this->parent->showStatusError( $status );
$this->parent->showMessage( 'config-mysql-egine-mismatch', $this->getVar( '_MysqlEngine' ), $existingEngine );
$this->setVar( '_MysqlEngine', $existingEngine );
}
- }
-
- /**
- * @todo FIXME: this code is just pure crap for compatibility between
- * old and new code.
- */
- public function doUpgrade() {
- global $wgDBuser, $wgDBpassword;
- # Some maintenance scripts like wfGetDB()
- LBFactory::enableBackend();
# Normal user and password are selected after this step, so for now
# just copy these two
$wgDBuser = $this->getVar( '_InstallUser' );
$wgDBpassword = $this->getVar( '_InstallPassword' );
-
- $ret = true;
-
- ob_start( array( $this, 'outputHandler' ) );
- try {
- $updater = DatabaseUpdater::newForDb( $this->db );
- $updater->doUpdates();
- } catch ( MWException $e ) {
- echo "\nAn error occured:\n";
- echo $e->getText();
- $ret = false;
- }
- ob_end_flush();
- return $ret;
}
/**
\$wgDBts2schema = \"{$ts2}\";";
}
- public function doUpgrade() {
- // TODO
- return false;
+ public function preUpgrade() {
+ global $wgDBuser, $wgDBpassword;
+
+ # Normal user and password are selected after this step, so for now
+ # just copy these two
+ $wgDBuser = $this->getVar( '_InstallUser' );
+ $wgDBpassword = $this->getVar( '_InstallPassword' );
}
}
return $status;
}
- public function doUpgrade() {
- LBFactory::enableBackend();
- $db = wfGetDB( DB_MASTER );
- ob_start( array( $this, 'outputHandler' ) );
- $updater = DatabaseUpdater::newForDb( $this->db );
- $updater->doUpdates();
- ob_end_flush();
- return true;
- }
-
public function getLocalSettings() {
$dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
return