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 );