aboutsummaryrefslogtreecommitdiffstats
path: root/include/dba
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-04-23 04:52:03 -0700
committerfriendica <info@friendica.com>2013-04-23 04:52:03 -0700
commit9d564913f6ea913a39fe2e4937dc4703452c769d (patch)
tree57ea610bc44ee7f8e041e5ddc724b57767c9ccbd /include/dba
parent9bff33f112b2ad60f17a9a75cd154f8c21b4dc56 (diff)
downloadvolse-hubzilla-9d564913f6ea913a39fe2e4937dc4703452c769d.tar.gz
volse-hubzilla-9d564913f6ea913a39fe2e4937dc4703452c769d.tar.bz2
volse-hubzilla-9d564913f6ea913a39fe2e4937dc4703452c769d.zip
dba driver cleanup
Diffstat (limited to 'include/dba')
-rw-r--r--include/dba/dba_driver.php22
1 files changed, 8 insertions, 14 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index cdc79e9a1..1091b9632 100644
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -11,7 +11,6 @@ function dba_factory($server,$user,$pass,$db,$install = false) {
require_once('include/dba/dba_mysql.php');
$dba = new dba_mysql($server,$user,$pass,$db,$install);
}
- $dba->connect($server,$user,$pass,$db);
return $dba;
}
@@ -20,7 +19,6 @@ function dba_factory($server,$user,$pass,$db,$install = false) {
abstract class dba_driver {
protected $debug = 0;
- protected $driver;
protected $db;
public $connected = false;
public $error = false;
@@ -31,22 +29,18 @@ abstract class dba_driver {
abstract function close();
function __construct($server,$user,$pass,$db,$install = false) {
- if($install)
- $this->install($server,$user,$pass,$db);
+ if(($install) && (! $this->install($server,$user,$pass,$db))) {
+ return;
+ }
$this->connect($server,$user,$pass,$db);
}
function install($server,$user,$pass,$db) {
- $server = trim($server);
- $user = trim($user);
- $pass = trim($pass);
- $db = trim($db);
-
if (!(strlen($server) && strlen($user))){
$this->connected = false;
$this->db = null;
- return;
+ return false;
}
if(strlen($server) && ($server !== 'localhost') && ($server !== '127.0.0.1')) {
@@ -54,15 +48,15 @@ abstract class dba_driver {
$this->error = sprintf( t('Cannot locate DNS info for database server \'%s\''), $server);
$this->connected = false;
$this->db = null;
- return;
+ return false;
}
}
}
- function dbg($dbg) {
- $this->debug = $dbg;
- }
+ function dbg($dbg) {
+ $this->debug = $dbg;
+ }
function __destruct() {
if($this->db && $this->connected) {