Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OC - debug further changes #734

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions src/object-cache.cls.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ public function __construct($cfg = false)
* @since 6.3
* @access private
*/
private function debug_oc($text, $show_error = false)
private function debug_oc($text)
{
if (defined('LSCWP_LOG')) {
Debug2::debug($text);

if (!$this->_cfg_debug) {
return;
}

if (!$show_error && !$this->_cfg_debug) {
if (defined('LSCWP_LOG')) {
Debug2::debug($text);

return;
}

Expand Down Expand Up @@ -292,8 +292,7 @@ private function _connect()
return false;
}

$this->debug_oc('Init ' . $this->_oc_driver . ' connection');
$this->debug_oc('connecting to ' . $this->_cfg_host . ':' . $this->_cfg_port);
$this->debug_oc('Initializing ' . $this->_oc_driver . ' connection to ' . $this->_cfg_host . ':' . $this->_cfg_port);

$failed = false;
/**
Expand Down Expand Up @@ -340,10 +339,10 @@ private function _connect()
$failed = true;
}
} catch (\Exception $e) {
$this->debug_oc('Redis connect exception: ' . $e->getMessage(), true);
$this->debug_oc('Redis connect exception: ' . $e->getMessage());
$failed = true;
} catch (\ErrorException $e) {
$this->debug_oc('Redis connect error: ' . $e->getMessage(), true);
$this->debug_oc('Redis connect error: ' . $e->getMessage());
$failed = true;
}
restore_error_handler();
Expand Down Expand Up @@ -389,15 +388,15 @@ private function _connect()

// If failed to connect
if ($failed) {
$this->debug_oc('❌ Failed to connect ' . $this->_oc_driver . ' server!', true);
$this->debug_oc('❌ Failed to connect ' . $this->_oc_driver . ' server!');
$this->_conn = null;
$this->_cfg_enabled = false;
!defined('LITESPEED_OC_FAILURE') && define('LITESPEED_OC_FAILURE', true);
// error_log( 'Object: false!' );
return false;
}

$this->debug_oc('Connected');
$this->debug_oc('Connected to ' . $this->_oc_driver . ' server.');

return true;
}
Expand Down
Loading