Automattic\WooCommerce\Internal\TransientFiles
TransientFilesEngine::add_debug_tools_entries()
Add the tools to (re)schedule and un-schedule the expired files cleanup actions in the WooCommerce debug tools page.
Method of the class: TransientFilesEngine{}
No Hooks.
Return
Array
. Updated debug tools array
Usage
// private - for code of main (parent) class only $result = $this->add_debug_tools_entries( $tools_array ): array;
- $tools_array(array) (required)
- Original debug tools array.
TransientFilesEngine::add_debug_tools_entries() TransientFilesEngine::add debug tools entries code WC 9.5.1
private function add_debug_tools_entries( array $tools_array ): array { $cleanup_is_scheduled = $this->expired_files_cleanup_is_scheduled(); $tools_array['schedule_expired_transient_files_cleanup'] = array( 'name' => $cleanup_is_scheduled ? __( 'Re-schedule expired transient files cleanup', 'woocommerce' ) : __( 'Schedule expired transient files cleanup', 'woocommerce' ), 'desc' => $cleanup_is_scheduled ? __( 'Remove the currently scheduled action to delete expired transient files, then schedule it again for running immediately. Subsequent actions will run once every 24h.', 'woocommerce' ) : __( 'Schedule the action to delete expired transient files for running immediately. Subsequent actions will run once every 24h.', 'woocommerce' ), 'button' => $cleanup_is_scheduled ? __( 'Re-schedule', 'woocommerce' ) : __( 'Schedule', 'woocommerce' ), 'requires_refresh' => true, 'callback' => array( $this, 'schedule_expired_files_cleanup' ), ); if ( $cleanup_is_scheduled ) { $tools_array['unschedule_expired_transient_files_cleanup'] = array( 'name' => __( 'Un-schedule expired transient files cleanup', 'woocommerce' ), 'desc' => __( "Remove the currently scheduled action to delete expired transient files. Expired files won't be automatically deleted until the 'Schedule expired transient files cleanup' tool is run again.", 'woocommerce' ), 'button' => __( 'Un-schedule', 'woocommerce' ), 'requires_refresh' => true, 'callback' => array( $this, 'unschedule_expired_files_cleanup' ), ); } return $tools_array; }