update: error mailing
This commit is contained in:
1 parent
0c189487c6
commit
88f01fe156
2 files changed
+19
-5
No files matched your search
@@ -35,9 +35,15 @@ function db_connect() {
|
||||
'password' => 'bBHofurUJWKzPE8Z',
|
||||
'database' => 'DEV',
|
||||
],
|
||||
'error' => [
|
||||
'hostaddr' => '10.233.1.244',
|
||||
'username' => 'error',
|
||||
'password' => 'bBHofurUJWKzPE8Z',
|
||||
'database' => 'DEV',
|
||||
]
|
||||
];
|
||||
|
||||
$enviroment = 'vpn';
|
||||
$enviroment = 'error';
|
||||
|
||||
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
|
||||
|
||||
@@ -55,11 +61,9 @@ function db_connect() {
|
||||
|
||||
} catch (mysqli_sql_exception $e) {
|
||||
|
||||
sendMail(
|
||||
"ERROR: Database connection failed",
|
||||
errorMail(
|
||||
$e->getMessage(),
|
||||
(new getSpecificData())->getRequestURL(),
|
||||
false
|
||||
"Database Connection failed"
|
||||
);
|
||||
|
||||
throw $e;
|
||||
|
||||
@@ -22,4 +22,14 @@ function sendMail($subject, $message, $url, bool $log) {
|
||||
(new getSpecificData())->getClientIP(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function errorMail($error, $title) {
|
||||
$headers = "From: bruno.eckhardt07@gmail.com\r\n";
|
||||
mail(
|
||||
"bruno.eckhardt07@gmail.com",+
|
||||
"ERROR: $title",
|
||||
$error->getMessage(),
|
||||
$headers,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user