From 240205b9b146df7856154c0854514e5fc8add1d4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Fri, 21 Jul 2017 02:44:36 +0200 Subject: [PATCH] #345 die on connection failure to not disclose dbinfo, enable QQ & QP error TODO reports --- db/connection/ConnectionMYS.php | 4 ++-- db/connection/ConnectionPG.php | 2 +- db/connection/ConnectionSQLite.php | 2 +- db/qq/QP.php | 2 +- db/qq/QQ.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db/connection/ConnectionMYS.php b/db/connection/ConnectionMYS.php index 62d5550..844b246 100644 --- a/db/connection/ConnectionMYS.php +++ b/db/connection/ConnectionMYS.php @@ -28,11 +28,11 @@ class ConnectionMYS extends ConnectionAbstr { public function __construct(DBInfo $dbinfo, $new_link = false, $client_flag = 0){ $this->connection = @mysqli_connect($dbinfo->m_host, $dbinfo->m_user, $dbinfo->m_password, $new_link, $client_flag); if(!$this->connection){ - throw new \Exception('Could not connect to Database. Check ur Database Settings');} + die('Could not connect to Database. Check ur Database Settings');} if(!mysqli_select_db($this->connection, $dbinfo->m_database)){ mysqli_close($this->connection); - throw new \Exception('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));} + die('Could not select Database. Check ur Database Settings: '.mysqli_error($this->connection));} \mysqli_set_charset($this->connection, 'utf8'); } diff --git a/db/connection/ConnectionPG.php b/db/connection/ConnectionPG.php index 0db36b5..31f92c0 100644 --- a/db/connection/ConnectionPG.php +++ b/db/connection/ConnectionPG.php @@ -27,7 +27,7 @@ class ConnectionPG extends ConnectionAbstr { $this->connection = pg_connect("host=".$dbinfo->m_host." port=".$dbinfo->m_port." dbname=".$dbinfo->m_database." user=".$dbinfo->m_user." password=".$dbinfo->m_password.""); if(!$this->connection){ - throw new \Exception('Could not connect to Database. Check ur Database Settings');} + die('Could not connect to Database. Check ur Database Settings');} } /** diff --git a/db/connection/ConnectionSQLite.php b/db/connection/ConnectionSQLite.php index 02d694e..18f2458 100644 --- a/db/connection/ConnectionSQLite.php +++ b/db/connection/ConnectionSQLite.php @@ -27,7 +27,7 @@ class ConnectionSQLite extends ConnectionAbstr { $error = null; $this->connection = new \SQLite3($dbinfo->m_database); if(!$this->connection){ - throw new \Exception('Could not connect to Database. Check ur Database Settings: '.$error);} + die('Could not connect to Database. Check ur Database Settings: '.$error);} } /** diff --git a/db/qq/QP.php b/db/qq/QP.php index 448d7aa..43b2054 100644 --- a/db/qq/QP.php +++ b/db/qq/QP.php @@ -45,7 +45,7 @@ class QP { return $con->prepare(static::get_class(),static::sqlite(),$params, \is_callable(static::get_class().'::types') ? static::types() : null); } } catch (\Exception $e){ - throw new \Exception(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);} + throw new \SYSTEM\LOG\ERROR(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);} throw new \Exception('Could not understand Database Settings. Check ur Database Settings'); } diff --git a/db/qq/QQ.php b/db/qq/QQ.php index 17a2e32..eaa7b36 100644 --- a/db/qq/QQ.php +++ b/db/qq/QQ.php @@ -45,7 +45,7 @@ class QQ { return $con->query(static::sqlite()); } } catch (\Exception $e){ - throw new \Exception(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);} + throw new \SYSTEM\LOG\ERROR(static::get_class().' failed causing: '.$e->getMessage(),$e->getCode(),$e);} throw new \Exception('Could not understand Database Settings. Check ur Database Settings'); }