From 9adb64b6b95c60eec4e23475cee5cd2cb891e115 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Sat, 19 Nov 2016 18:10:55 +0100 Subject: [PATCH] Restore log deletion from admin log viewer page WC_Logger no longer controls logging and has no knowledge of files. Correctly handle `remove_log` action via file log handler. --- includes/admin/class-wc-admin-status.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/admin/class-wc-admin-status.php b/includes/admin/class-wc-admin-status.php index b065b871424..8f09658d374 100644 --- a/includes/admin/class-wc-admin-status.php +++ b/includes/admin/class-wc-admin-status.php @@ -250,8 +250,13 @@ class WC_Admin_Status { } if ( ! empty( $_REQUEST['handle'] ) ) { - $logger = wc_get_logger(); - $logger->remove( $_REQUEST['handle'] ); + + if ( ! class_exists( 'WC_Log_Handler_File' ) ) { + include_once( dirname( dirname( __FILE__ ) ) . '/log-handlers/class-wc-log-handler-file.php' ); + } + + $log_handler = new WC_Log_Handler_File(); + $log_handler->remove( $_REQUEST['handle'] ); } wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );