* Use camel case in tableName and dbName, dontrunallyourwordstogetherlikethis
* Call the function factory() instead of newFromType(), for consistency with the rest of MediaWiki
*
* @param $dbType String A possible DB type
* @param $p Array An array of options to pass to the constructor.
*
* @param $dbType String A possible DB type
* @param $p Array An array of options to pass to the constructor.
- * Valid options are: host, user, password, dbname, flags, tableprefix
+ * Valid options are: host, user, password, dbName, flags, tablePrefix
* @return DatabaseBase subclass or null
*/
* @return DatabaseBase subclass or null
*/
- public final static function newFromType( $dbType, $p = array() ) {
+ public final static function factory( $dbType, $p = array() ) {
$canonicalDBTypes = array(
'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2'
);
$canonicalDBTypes = array(
'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2'
);
isset( $p['host'] ) ? $p['host'] : false,
isset( $p['user'] ) ? $p['user'] : false,
isset( $p['password'] ) ? $p['password'] : false,
isset( $p['host'] ) ? $p['host'] : false,
isset( $p['user'] ) ? $p['user'] : false,
isset( $p['password'] ) ? $p['password'] : false,
- isset( $p['dbname'] ) ? $p['dbname'] : false,
+ isset( $p['dbName'] ) ? $p['dbName'] : false,
isset( $p['flags'] ) ? $p['flags'] : 0,
isset( $p['flags'] ) ? $p['flags'] : 0,
- isset( $p['tableprefix'] ) ? $p['tableprefix'] : 'get from global'
+ isset( $p['tablePrefix'] ) ? $p['tablePrefix'] : 'get from global'
# Create object
wfDebug( "Connecting to $host $dbname...\n" );
# Create object
wfDebug( "Connecting to $host $dbname...\n" );
- $db = DatabaseBase::newFromType( $server['type'], $server );
+ $db = DatabaseBase::factory( $server['type'], $server );
if ( $db->isOpen() ) {
wfDebug( "Connected to $host $dbname.\n" );
} else {
if ( $db->isOpen() ) {
wfDebug( "Connected to $host $dbname.\n" );
} else {
private function initFromCond( $cond ) {
global $wgExternalAuthConf;
private function initFromCond( $cond ) {
global $wgExternalAuthConf;
- $this->mDb = DatabaseBase::newFromType( $wgExternalAuthConf['DBtype'],
+ $this->mDb = DatabaseBase::factory( $wgExternalAuthConf['DBtype'],
array(
'host' => $wgExternalAuthConf['DBserver'],
'user' => $wgExternalAuthConf['DBuser'],
'password' => $wgExternalAuthConf['DBpassword'],
array(
'host' => $wgExternalAuthConf['DBserver'],
'user' => $wgExternalAuthConf['DBuser'],
'password' => $wgExternalAuthConf['DBpassword'],
- 'dbname' => $wgExternalAuthConf['DBname'],
- 'tableprefix' => $wgExternalAuthConf['DBprefix'],
+ 'dbName' => $wgExternalAuthConf['DBname'],
+ 'tablePrefix' => $wgExternalAuthConf['DBprefix'],
* 'server' => 'localhost',
* 'username' => 'forum',
* 'password' => 'udE,jSqDJ<""p=fI.K9',
* 'server' => 'localhost',
* 'username' => 'forum',
* 'password' => 'udE,jSqDJ<""p=fI.K9',
- * 'dbname' => 'forum',
- * 'tableprefix' => '',
+ * 'dbName' => 'forum',
+ * 'tablePrefix' => '',
* 'cookieprefix' => 'bb'
* );
*
* 'cookieprefix' => 'bb'
* );
*
$wgExternalAuthConf['server'],
$wgExternalAuthConf['username'],
$wgExternalAuthConf['password'],
$wgExternalAuthConf['server'],
$wgExternalAuthConf['username'],
$wgExternalAuthConf['password'],
- $wgExternalAuthConf['dbname'],
+ $wgExternalAuthConf['dbName'],
- $wgExternalAuthConf['tableprefix']
+ $wgExternalAuthConf['tablePrefix']
function getMasterDB() {
if ( !isset( $this->dbConn ) ) {
function getMasterDB() {
if ( !isset( $this->dbConn ) ) {
- $this->dbConn = DatabaseBase::newFromType( $this->dbType,
+ $this->dbConn = DatabaseBase::factory( $this->dbType,
array(
'host' => $this->dbServer,
'user' => $this->dbUser,
'password' => $this->dbPassword,
array(
'host' => $this->dbServer,
'user' => $this->dbUser,
'password' => $this->dbPassword,
- 'dbname' => $this->dbName,
+ 'dbName' => $this->dbName,
'flags' => $this->dbFlags,
'flags' => $this->dbFlags,
- 'tableprefix' => $this->tablePrefix
+ 'tablePrefix' => $this->tablePrefix
$dbSupport = '';
foreach( $this->parent->getDBTypes() as $type ) {
$dbSupport = '';
foreach( $this->parent->getDBTypes() as $type ) {
- $link = DatabaseBase::newFromType( $type )->getSoftwareLink();
+ $link = DatabaseBase::factory( $type )->getSoftwareLink();
$dbSupport .= wfMsgNoTrans( "config-support-$type", $link ) . "\n";
}
$this->addHTML( $this->parent->getInfoBox(
$dbSupport .= wfMsgNoTrans( "config-support-$type", $link ) . "\n";
}
$this->addHTML( $this->parent->getInfoBox(