mirror of https://github.com/BOINC/boinc.git
BoincDb::get():
if open to different dbnum, close and reconnect. Don't throw exception if connect fails
This commit is contained in:
parent
4b4ba9dbf8
commit
da1727c64f
|
@ -105,7 +105,10 @@ class BoincDb {
|
|||
static function get($dbnum = 0) {
|
||||
global $generating_xml;
|
||||
if (isset(self::$instance)) {
|
||||
return self::$instance;
|
||||
if (self::$dbnum == $dbnum) {
|
||||
return self::$instance;
|
||||
}
|
||||
close();
|
||||
}
|
||||
if (web_stopped()) {
|
||||
if ($generating_xml) {
|
||||
|
|
|
@ -33,14 +33,10 @@ class DbConn {
|
|||
} else {
|
||||
$port = null;
|
||||
}
|
||||
if (1) { // don't use persistent connections for now
|
||||
$this->db_conn = @new mysqli(
|
||||
$host, $user, $passwd, $name, $port
|
||||
);
|
||||
} else {
|
||||
$this->db_conn = @new mysqli(
|
||||
'p:'.$host, $user, $passwd, $name, $port
|
||||
);
|
||||
try {
|
||||
$this->db_conn = @new mysqli($host, $user, $passwd, $name, $port);
|
||||
} catch(Exception $e) {
|
||||
return false;
|
||||
}
|
||||
if (mysqli_connect_error()) {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue