Don't disconnect a DB_Error, instead log for better understanding.

This commit is contained in:
Mikael Nordfeldth 2013-10-22 18:53:26 +02:00
parent c423e84776
commit f54584c126

View File

@ -758,7 +758,9 @@ class Memcached_DataObject extends Safe_DataObject
// we'll need some fancier logic here. // we'll need some fancier logic here.
if (!$exists && !empty($_DB_DATAOBJECT['CONNECTIONS']) && php_sapi_name() == 'cli') { if (!$exists && !empty($_DB_DATAOBJECT['CONNECTIONS']) && php_sapi_name() == 'cli') {
foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $index => $conn) { foreach ($_DB_DATAOBJECT['CONNECTIONS'] as $index => $conn) {
if (!empty($conn)) { if ($_PEAR->isError($conn)) {
common_log(LOG_WARNING, __METHOD__ . " cannot disconnect failed DB connection: '".$conn->getMessage()."'.");
} elseif (!empty($conn)) {
$conn->disconnect(); $conn->disconnect();
} }
unset($_DB_DATAOBJECT['CONNECTIONS'][$index]); unset($_DB_DATAOBJECT['CONNECTIONS'][$index]);