dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
969b8f8
)
Per ^demon's comment on r71430: moved doUpgrade() to DatabaseInstaller (did not remov...
author
Alexandre Emsenhuber
<ialex@users.mediawiki.org>
Tue, 7 Sep 2010 20:57:53 +0000
(20:57 +0000)
committer
Alexandre Emsenhuber
<ialex@users.mediawiki.org>
Tue, 7 Sep 2010 20:57:53 +0000
(20:57 +0000)
includes/installer/DatabaseInstaller.php
patch
|
blob
|
history
includes/installer/MysqlInstaller.php
patch
|
blob
|
history
includes/installer/PostgresInstaller.php
patch
|
blob
|
history
includes/installer/SqliteInstaller.php
patch
|
blob
|
history
diff --git
a/includes/installer/DatabaseInstaller.php
b/includes/installer/DatabaseInstaller.php
index
099742f
..
4681d57
100644
(file)
--- a/
includes/installer/DatabaseInstaller.php
+++ b/
includes/installer/DatabaseInstaller.php
@@
-141,14
+141,30
@@
abstract class DatabaseInstaller {
*
* @return String
*/
*
* @return String
*/
- public abstract function getLocalSettings();
+ public abstract function getLocalSettings();
/**
* Perform database upgrades
*
* @return Boolean
*/
/**
* 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
/**
* Allow DB installers a chance to make last-minute changes before installation
diff --git
a/includes/installer/MysqlInstaller.php
b/includes/installer/MysqlInstaller.php
index
8d483bd
..
3876d1a
100644
(file)
--- a/
includes/installer/MysqlInstaller.php
+++ b/
includes/installer/MysqlInstaller.php
@@
-131,6
+131,8
@@
class MysqlInstaller extends DatabaseInstaller {
}
public function preUpgrade() {
}
public function preUpgrade() {
+ global $wgDBuser, $wgDBpassword;
+
$status = $this->getConnection();
if ( !$status->isOK() ) {
$this->parent->showStatusError( $status );
$status = $this->getConnection();
if ( !$status->isOK() ) {
$this->parent->showStatusError( $status );
@@
-178,35
+180,11
@@
class MysqlInstaller extends DatabaseInstaller {
$this->parent->showMessage( 'config-mysql-egine-mismatch', $this->getVar( '_MysqlEngine' ), $existingEngine );
$this->setVar( '_MysqlEngine', $existingEngine );
}
$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' );
# 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;
}
/**
}
/**
diff --git
a/includes/installer/PostgresInstaller.php
b/includes/installer/PostgresInstaller.php
index
48602a7
..
75ff055
100644
(file)
--- a/
includes/installer/PostgresInstaller.php
+++ b/
includes/installer/PostgresInstaller.php
@@
-126,8
+126,12
@@
class PostgresInstaller extends DatabaseInstaller {
\$wgDBts2schema = \"{$ts2}\";";
}
\$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' );
}
}
}
}
diff --git
a/includes/installer/SqliteInstaller.php
b/includes/installer/SqliteInstaller.php
index
a06d4c8
..
5109539
100644
(file)
--- a/
includes/installer/SqliteInstaller.php
+++ b/
includes/installer/SqliteInstaller.php
@@
-170,16
+170,6
@@
class SqliteInstaller extends DatabaseInstaller {
return $status;
}
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
public function getLocalSettings() {
$dir = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgSQLiteDataDir' ) );
return