mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 04:10:38 +02:00
e_db_pdo: Throw exception instead of fatal erroring on connect fail
Now e_db_pdo failures to connect to the database are catchable
This commit is contained in:
@@ -1363,7 +1363,7 @@ class e107
|
||||
* $instance_id
|
||||
*
|
||||
* @param string $instance_id
|
||||
* @return e_db_mysql
|
||||
* @return e_db
|
||||
*/
|
||||
public static function getDb($instance_id = '')
|
||||
{
|
||||
|
@@ -2808,19 +2808,11 @@ class e_db_pdo implements e_db
|
||||
*/
|
||||
private function _getMySQLaccess()
|
||||
{
|
||||
/*if (!$this->mySQLaccess) {
|
||||
global $db_ConnectionID;
|
||||
$this->mySQLaccess = $db_ConnectionID;
|
||||
debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2);
|
||||
|
||||
}*/
|
||||
|
||||
if (!$this->mySQLaccess)
|
||||
{
|
||||
// debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2);
|
||||
$this->connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword);
|
||||
$this->database($this->mySQLdefaultdb, $this->mySQLPrefix);
|
||||
//$this->mySQLaccess = e107::getDb()->get_mySQLaccess();
|
||||
$success = $this->connect($this->mySQLserver, $this->mySQLuser, $this->mySQLpassword);
|
||||
if ($success) $success = $this->database($this->mySQLdefaultdb, $this->mySQLPrefix);
|
||||
if (!$success) throw new PDOException($this->mySQLlastErrText);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user