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:
b56235a
)
Partial revert r69128: go back to making isCompiled() an instance method rather than...
author
Chad Horohoe
<demon@users.mediawiki.org>
Wed, 7 Jul 2010 13:52:05 +0000
(13:52 +0000)
committer
Chad Horohoe
<demon@users.mediawiki.org>
Wed, 7 Jul 2010 13:52:05 +0000
(13:52 +0000)
includes/installer/Installer.php
patch
|
blob
|
history
includes/installer/InstallerDBType.php
patch
|
blob
|
history
includes/installer/MysqlInstaller.php
patch
|
blob
|
history
includes/installer/OracleInstaller.php
patch
|
blob
|
history
includes/installer/PostgresInstaller.php
patch
|
blob
|
history
includes/installer/SqliteInstaller.php
patch
|
blob
|
history
diff --git
a/includes/installer/Installer.php
b/includes/installer/Installer.php
index
7c44ddb
..
9ec3c42
100644
(file)
--- a/
includes/installer/Installer.php
+++ b/
includes/installer/Installer.php
@@
-235,7
+235,7
@@
abstract class Installer {
}
foreach ( $this->dbTypes as $type ) {
$installer = $this->getDBInstaller( $type );
}
foreach ( $this->dbTypes as $type ) {
$installer = $this->getDBInstaller( $type );
- if ( !$installer ) {
+ if ( !$installer
->isCompiled()
) {
continue;
}
$defaults = $installer->getGlobalDefaults();
continue;
}
$defaults = $installer->getGlobalDefaults();
@@
-282,11
+282,7
@@
abstract class Installer {
if ( !isset( $this->dbInstallers[$type] ) ) {
$class = ucfirst( $type ). 'Installer';
if ( !isset( $this->dbInstallers[$type] ) ) {
$class = ucfirst( $type ). 'Installer';
- if ( call_user_func( array( $class, 'isCompiled' ) ) ) {
- $this->dbInstallers[$type] = new $class( $this );
- } else {
- $this->dbInstallers[$type] = false;
- }
+ $this->dbInstallers[$type] = new $class( $this );
}
return $this->dbInstallers[$type];
}
}
return $this->dbInstallers[$type];
}
@@
-867,6
+863,7
@@
abstract class Installer {
*/
public function performInstallation( $startCB, $endCB ) {
$installResults = array();
*/
public function performInstallation( $startCB, $endCB ) {
$installResults = array();
+ $installer = $this->getDBInstaller();
foreach( $this->getInstallSteps() as $stepObj ) {
$step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
call_user_func_array( $startCB, array( $step ) );
foreach( $this->getInstallSteps() as $stepObj ) {
$step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
call_user_func_array( $startCB, array( $step ) );
@@
-880,7
+877,7
@@
abstract class Installer {
} else {
# Boring implicitly named callback
$func = 'install' . ucfirst( $step );
} else {
# Boring implicitly named callback
$func = 'install' . ucfirst( $step );
- $status = $this->{$func}();
+ $status = $this->{$func}(
$installer
);
}
call_user_func_array( $endCB, array( $step, $status ) );
$installResults[$step] = $status;
}
call_user_func_array( $endCB, array( $step, $status ) );
$installResults[$step] = $status;
@@
-903,10
+900,9
@@
abstract class Installer {
return Status::newGood();
}
return Status::newGood();
}
- public function installDatabase() {
- $type = $this->getVar( 'wgDBtype' );
- $installer = $this->getDBInstaller( $type );
+ public function installDatabase( &$installer ) {
if(!$installer) {
if(!$installer) {
+ $type = $this->getVar( 'wgDBtype' );
$status = Status::newFatal( "config-no-db", $type );
} else {
$status = $installer->setupDatabase();
$status = Status::newFatal( "config-no-db", $type );
} else {
$status = $installer->setupDatabase();
@@
-914,8
+910,7
@@
abstract class Installer {
return $status;
}
return $status;
}
- public function installTables() {
- $installer = $this->getDBInstaller();
+ public function installTables( &$installer ) {
$status = $installer->createTables();
if( $status->isOK() ) {
LBFactory::enableBackend();
$status = $installer->createTables();
if( $status->isOK() ) {
LBFactory::enableBackend();
@@
-923,8
+918,7
@@
abstract class Installer {
return $status;
}
return $status;
}
- public function installInterwiki() {
- $installer = $this->getDBInstaller();
+ public function installInterwiki( &$installer ) {
return $installer->populateInterwikiTable();
}
return $installer->populateInterwikiTable();
}
diff --git
a/includes/installer/InstallerDBType.php
b/includes/installer/InstallerDBType.php
index
a37110e
..
0081612
100644
(file)
--- a/
includes/installer/InstallerDBType.php
+++ b/
includes/installer/InstallerDBType.php
@@
-24,7
+24,7
@@
abstract class InstallerDBType {
/**
* @return true if the client library is compiled in
*/
/**
* @return true if the client library is compiled in
*/
- abstract
stat
ic function isCompiled();
+ abstract
publ
ic function isCompiled();
/**
* Get an array of MW configuration globals that will be configured by this class.
/**
* Get an array of MW configuration globals that will be configured by this class.
@@
-77,6
+77,13
@@
abstract class InstallerDBType {
*/
abstract function getConnection();
*/
abstract function getConnection();
+ /**
+ * Allow DB installers a chance to make last-minute changes before installation
+ * occurs. This happens before setupDatabase() or createTables() is called, but
+ * long after the constructor. Helpful for things like modifying setup steps :)
+ */
+ public function preInstall() {}
+
/**
* Create the database and return a Status object indicating success or
* failure.
/**
* Create the database and return a Status object indicating success or
* failure.
@@
-126,7
+133,7
@@
abstract class InstallerDBType {
* Convenience function
* Check if a named extension is present
*/
* Convenience function
* Check if a named extension is present
*/
- static function checkExtension( $name ) {
+
protected
static function checkExtension( $name ) {
wfSuppressWarnings();
$compiled = wfDl( $name );
wfRestoreWarnings();
wfSuppressWarnings();
$compiled = wfDl( $name );
wfRestoreWarnings();
diff --git
a/includes/installer/MysqlInstaller.php
b/includes/installer/MysqlInstaller.php
index
348e716
..
e1c6706
100644
(file)
--- a/
includes/installer/MysqlInstaller.php
+++ b/
includes/installer/MysqlInstaller.php
@@
-34,22
+34,9
@@
class MysqlInstaller extends InstallerDBType {
function __construct( $parent ) {
parent::__construct( $parent );
function __construct( $parent ) {
parent::__construct( $parent );
-
- if ( $this->parent->getVar( 'wgDBtype' ) !== $this->getName() ) {
- return;
- }
-
- # Add our user callback to installSteps, right before the tables are created.
- $callback = array(
- array(
- 'name' => 'user',
- 'callback' => array( &$this, 'setupUser' ),
- )
- );
- $this->parent->addInstallStepFollowing( "tables", $callback );
}
}
-
stat
ic function isCompiled() {
+
publ
ic function isCompiled() {
return self::checkExtension( 'mysql' );
}
return self::checkExtension( 'mysql' );
}
@@
-379,6
+366,17
@@
class MysqlInstaller extends InstallerDBType {
return Status::newGood();
}
return Status::newGood();
}
+ public function preInstall() {
+ # Add our user callback to installSteps, right before the tables are created.
+ $callback = array(
+ array(
+ 'name' => 'user',
+ 'callback' => array( &$this, 'setupUser' ),
+ )
+ );
+ $this->parent->addInstallStepFollowing( "tables", $callback );
+ }
+
function setupDatabase() {
$status = $this->getConnection();
if ( !$status->isOK() ) {
function setupDatabase() {
$status = $this->getConnection();
if ( !$status->isOK() ) {
diff --git
a/includes/installer/OracleInstaller.php
b/includes/installer/OracleInstaller.php
index
a6cc135
..
ba3a5ca
100644
(file)
--- a/
includes/installer/OracleInstaller.php
+++ b/
includes/installer/OracleInstaller.php
@@
-19,7
+19,7
@@
class OracleInstaller extends InstallerDBType {
return 'oracle';
}
return 'oracle';
}
-
stat
ic function isCompiled() {
+
publ
ic function isCompiled() {
return self::checkExtension( 'oci8' );
}
return self::checkExtension( 'oci8' );
}
diff --git
a/includes/installer/PostgresInstaller.php
b/includes/installer/PostgresInstaller.php
index
65d4116
..
859e3fb
100644
(file)
--- a/
includes/installer/PostgresInstaller.php
+++ b/
includes/installer/PostgresInstaller.php
@@
-25,7
+25,7
@@
class PostgresInstaller extends InstallerDBType {
return 'postgres';
}
return 'postgres';
}
-
stat
ic function isCompiled() {
+
publ
ic function isCompiled() {
return self::checkExtension( 'pgsql' );
}
return self::checkExtension( 'pgsql' );
}
diff --git
a/includes/installer/SqliteInstaller.php
b/includes/installer/SqliteInstaller.php
index
86c5a16
..
9edc7e1
100644
(file)
--- a/
includes/installer/SqliteInstaller.php
+++ b/
includes/installer/SqliteInstaller.php
@@
-10,7
+10,7
@@
class SqliteInstaller extends InstallerDBType {
return 'sqlite';
}
return 'sqlite';
}
-
stat
ic function isCompiled() {
+
publ
ic function isCompiled() {
return self::checkExtension( 'pdo_sqlite' );
}
return self::checkExtension( 'pdo_sqlite' );
}