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.
This commit is contained in:
Jon Surrell 2016-11-19 18:10:55 +01:00
parent b645fa06b7
commit 9adb64b6b9
1 changed files with 7 additions and 2 deletions

View File

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