function setup_cron()
{
add_filter("simple_history/maybe_purge_db", array($this, "maybe_purge_db"));
if (!wp_next_scheduled('simple_history/maybe_purge_db')) {
wp_schedule_event(time(), 'daily', 'simple_history/maybe_purge_db');
//error_log("not scheduled, so do schedule");
} else {
//error_log("is scheduled");
}
// Remove old schedule (only author dev sites should have it)
$old_next_scheduled = wp_next_scheduled('simple_history/purge_db');
if ($old_next_scheduled) {
wp_unschedule_event($old_next_scheduled, 'simple_history/purge_db');
}
}