mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 17:59:55 +02:00
Update
This commit is contained in:
parent
901c084e1a
commit
3911a2689e
1 changed files with 6 additions and 3 deletions
|
@ -275,9 +275,12 @@ function _mysql_is_open()
|
|||
return false;
|
||||
}
|
||||
|
||||
// Use ping() to check if the connection is alive
|
||||
if (!$global['mysqli']->ping()) {
|
||||
error_log("MySQL connection ping failed; connection appears to be closed. Error: " . $global['mysqli']->error);
|
||||
$result = $global['mysqli']->query("SELECT 1");
|
||||
if ($result) {
|
||||
$result->free();
|
||||
return true;
|
||||
} else {
|
||||
error_log("MySQL connection test query failed. Connection appears to be closed. Error: " . $global['mysqli']->error);
|
||||
return false;
|
||||
}
|
||||
} catch (Exception $exc) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue