mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-04 02:09:22 +02:00
Update
This commit is contained in:
parent
2aedcec608
commit
2eee104d9b
1 changed files with 17 additions and 8 deletions
|
@ -247,26 +247,35 @@ function _mysql_close()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the MySQL connection is open and valid.
|
||||
*
|
||||
* @return bool True if the connection is open, false otherwise.
|
||||
*/
|
||||
function _mysql_is_open()
|
||||
{
|
||||
global $global, $mysql_connect_was_closed;
|
||||
try {
|
||||
/**
|
||||
*
|
||||
* @var array $global
|
||||
* @var object $global['mysqli']
|
||||
*/
|
||||
//if (is_object($global['mysqli']) && (empty($mysql_connect_was_closed) || !empty(@$global['mysqli']->ping()))) {
|
||||
if (!empty($global['mysqli']) && is_object($global['mysqli']) && empty($mysql_connect_was_closed) && isset($global['mysqli']->server_info) && is_resource($global['mysqli']) && get_resource_type($global['mysqli']) === 'mysql link') {
|
||||
return true;
|
||||
if (!empty($global['mysqli']) && ($global['mysqli'] instanceof mysqli) && empty($mysql_connect_was_closed)) {
|
||||
if ($global['mysqli']->ping()) {
|
||||
return true;
|
||||
} else {
|
||||
error_log("MySQL connection ping failed: " . $global['mysqli']->error);
|
||||
}
|
||||
} else {
|
||||
error_log("MySQL connection object is either empty, not an instance of mysqli, or has been marked as closed.");
|
||||
}
|
||||
} catch (Exception $exc) {
|
||||
error_log("Exception in _mysql_is_open: " . $exc->getMessage());
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function lockForUpdate($tableName, $condition)
|
||||
{
|
||||
global $global;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue