diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a7151c45898820a35f826b845637953b9710c72..d062e4db49794bbd16088468bee810a43632461d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.6.2] - 2020-07-21 +### Fixed +- Notice error when cannot create log file + ## [1.6.1] - 2020-05-25 ### Fixed - WooCommerceCapture checks if WC exists before proceeding diff --git a/src/WP/WPCapture.php b/src/WP/WPCapture.php index f532de2e7c9c957fdeecae0f1c9a1f14b41efafa..ddc915533277fef60e9de05af106efa70abd591b 100644 --- a/src/WP/WPCapture.php +++ b/src/WP/WPCapture.php @@ -27,7 +27,7 @@ class WPCapture { ), $dir ), - WPDesk\Notice\Notice::NOTICE_TYPE_ERROR + \WPDesk\Notice\Notice::NOTICE_TYPE_ERROR ); } @@ -46,7 +46,7 @@ class WPCapture { ), $file ), - WPDesk\Notice\Notice::NOTICE_TYPE_ERROR + \WPDesk\Notice\Notice::NOTICE_TYPE_ERROR ); } @@ -87,7 +87,11 @@ class WPCapture { } } - return true; + if (!is_writable($log_file)) { + $this->add_notice_for_file($log_file); + return false; + } + return true; } /** diff --git a/src/WPDeskLoggerFactory.php b/src/WPDeskLoggerFactory.php index d57346532792028bde71cb7cc1783d8e9d6ecfc2..6b39b9c1ea0089cd2409a2237b263cd59f3a2d19 100644 --- a/src/WPDeskLoggerFactory.php +++ b/src/WPDeskLoggerFactory.php @@ -114,7 +114,9 @@ class WPDeskLoggerFactory extends BasicLoggerFactory */ private function appendMainLog($logger) { $wpCapture = $this->captureWPLog(); - $this->appendFileLog($logger, $wpCapture->get_log_file()); + if (is_writable($wpCapture->get_log_file())) { + $this->appendFileLog($logger, $wpCapture->get_log_file()); + } } /**