From 402f3c4e56fe9dbc5144058fa7334b934e67e962 Mon Sep 17 00:00:00 2001 From: Peter Janes Date: Tue, 30 Apr 2019 08:52:06 -0400 Subject: [PATCH] Don't try to check the size of nginx.log if it doesn't exist --- admin/class-purger.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/class-purger.php b/admin/class-purger.php index 4899c428..e27dcb61 100644 --- a/admin/class-purger.php +++ b/admin/class-purger.php @@ -559,8 +559,16 @@ public function check_and_truncate_log_file() { global $nginx_helper_admin; + if ( ! $nginx_helper_admin->options['enable_log'] ) { + return; + } + $nginx_asset_path = $nginx_helper_admin->functional_asset_path() . 'nginx.log'; + if ( ! file_exists($nginx_asset_path) ) { + return; + } + $max_size_allowed = ( is_numeric( $nginx_helper_admin->options['log_filesize'] ) ) ? $nginx_helper_admin->options['log_filesize'] * 1048576 : 5242880; $fileSize = filesize( $nginx_asset_path );