From 5f1abd246159f5404d62f683c3b7364d3de020a6 Mon Sep 17 00:00:00 2001 From: Matthias Pfefferle Date: Wed, 21 Jun 2023 15:45:03 +0200 Subject: [PATCH] fail early --- includes/class-scheduler.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/includes/class-scheduler.php b/includes/class-scheduler.php index a5cfbc8..293b610 100644 --- a/includes/class-scheduler.php +++ b/includes/class-scheduler.php @@ -80,22 +80,24 @@ class Scheduler { $activity_type = 'Delete'; } - if ( $activity_type ) { - \wp_schedule_single_event( - \time(), - 'activitypub_send_activity', - array( $activitypub_post, $activity_type ) - ); - - \wp_schedule_single_event( - \time(), - sprintf( - 'activitypub_send_%s_activity', - \strtolower( $activity_type ) - ), - array( $activitypub_post ) - ); + if ( ! $activity_type ) { + return; } + + \wp_schedule_single_event( + \time(), + 'activitypub_send_activity', + array( $activitypub_post, $activity_type ) + ); + + \wp_schedule_single_event( + \time(), + sprintf( + 'activitypub_send_%s_activity', + \strtolower( $activity_type ) + ), + array( $activitypub_post ) + ); } /**