From 3c56738de7f756ae04df19a9d2a6047dcca5ae48 Mon Sep 17 00:00:00 2001 From: Timotei Date: Fri, 30 Aug 2024 02:32:35 +0300 Subject: [PATCH] Changes Removed $show_error parameter. I saw many complains about this message appearing when debug is off and error connecting to OC server removed extra code Updating debug message --- src/object-cache.cls.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/object-cache.cls.php b/src/object-cache.cls.php index 08758c799..892c45185 100644 --- a/src/object-cache.cls.php +++ b/src/object-cache.cls.php @@ -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; } @@ -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; /** @@ -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(); @@ -389,7 +388,7 @@ 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); @@ -397,7 +396,7 @@ private function _connect() return false; } - $this->debug_oc('Connected'); + $this->debug_oc('✅ Connected to ' . $this->_oc_driver . ' server.'); return true; }