Freemius / wordpress-sdk

https://freemius.com
GNU General Public License v3.0
258 stars 76 forks source link

[debug] [logging] Automatically turn off `fs_debug_mode`after 24 hours #691

Open DanieleAlessandra opened 3 months ago

DanieleAlessandra commented 3 months ago

When the user activates debugging a single event cron starts: wp_schedule_single_event(time() + 24 * HOUR_IN_SECONDS, 'fs_debug_turn_off_logging_hook');

When the user deactivates debuggong this cron is unscheduled: wp_unschedule_event($timestamp, 'fs_debug_turn_off_logging_hook');

If the event happens, the option is set to off: add_action('fs_debug_turn_off_logging_hook', array( self::class, '_turn_off_debug_mode' ) );

Also, in the debug page I added a countdown timer, so the user is informed about the fact that debugging will be disabled automatically. image