Commit b1d401af authored by Jonathan Harker's avatar Jonathan Harker

Use the database factory, Luke.

parent 99896cf6
......@@ -23,7 +23,7 @@ require_once('includes/AuthPlugin.php');
$wgExtensionCredits['other'][] = array(
'name' => 'Mahara Authentication Plugin',
'author' => 'Brett Wilkins',
'url' => 'https://git.mahara.org/scripts/mediawiki-auth-mahara',
'url' => 'http://gitorious.org/mahara-contrib/mediawiki-auth-mahara',
'description' => 'Authenticates against users in the Mahara database'
);
......@@ -46,9 +46,10 @@ class MaharaAuthPlugin extends AuthPlugin {
var $dbpass;
var $passwordsaltmain;
public function __construct($dbname, $host='localhost',$dbtype='', $user='', $password='', $prefix='', $passwordsaltmain='') {
public function __construct($dbname, $host='localhost',$dbtype='', $user='', $password='', $port=5432, $prefix='', $passwordsaltmain='') {
$this->dbname = $dbname;
$this->host = $host;
$this->dbport = $port;
$this->prefix = $prefix;
$this->dbtype = $dbtype;
$this->dbuser = $user;
......@@ -370,14 +371,12 @@ class MaharaAuthPlugin extends AuthPlugin {
if (empty($this->dbtype)) {
return false;
}
switch ($this->dbtype) {
case 'mysql':
return new DatabaseMysql($this->host,$this->dbuser,$this->dbpass,$this->dbname);
case 'postgres':
default:
return new DatabasePostgres($this->host,$this->dbuser,$this->dbpass,$this->dbname);
}
return false;
return Database::factory($this->dbtype, array(
'host' => $this->host . ":" . $this->dbport,
'user' => $this->dbuser,
'password' => $this->dbpass,
'dbname' => $this->dbname
));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment