ActionScheduler_WPCommentCleaner::maybe_schedule_cleanup()public staticWC 1.0

Schedules the WP Post comment table cleanup to run in 6 months if it's not already scheduled. Attached to the migration complete hook 'action_scheduler/migration_complete'.

Method of the class: ActionScheduler_WPCommentCleaner{}

No Hooks.

Return

null. Nothing (null).

Usage

$result = ActionScheduler_WPCommentCleaner::maybe_schedule_cleanup();

ActionScheduler_WPCommentCleaner::maybe_schedule_cleanup() code WC 8.6.1

public static function maybe_schedule_cleanup() {
	if ( (bool) get_comments( array( 'type' => ActionScheduler_wpCommentLogger::TYPE, 'number' => 1, 'fields' => 'ids' ) ) ) {
		update_option( self::$has_logs_option_key, 'yes' );

		if ( ! as_next_scheduled_action( self::$cleanup_hook ) ) {
			as_schedule_single_action( gmdate( 'U' ) + ( 6 * MONTH_IN_SECONDS ), self::$cleanup_hook );
		}
	}
}