Task_12281 (#1)

Co-authored-by: User A0264400 <a0264400@jarl.from.sh>
Reviewed-on: #1
Co-authored-by: Anton.AE <ab.an.ev@yandex.ru>
Co-committed-by: Anton.AE <ab.an.ev@yandex.ru>
This commit is contained in:
2026-07-05 16:07:04 +03:00
committed by Антон
parent 50f3a8e626
commit 3e42863ef5
2878 changed files with 59059 additions and 181273 deletions

View File

@@ -0,0 +1,31 @@
<?php
/**
* Used to clean-up logs.
*/
add_action(
'wp_ajax_wrio_logs_cleanup',
function () {
check_admin_referer( 'wrio_clean_logs', 'nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( - 1 );
}
if ( ! WRIO_Plugin::app()->logger->clean_up() ) {
wp_send_json_error(
[
'message' => esc_html__( 'Failed to clear logs. Please try again later.', 'robin-image-optimizer' ),
'type' => 'danger',
]
);
}
wp_send_json(
[
'message' => esc_html__( 'Logs cleared successfully.', 'robin-image-optimizer' ),
'type' => 'success',
]
);
}
);