PluginProbe ʕ •ᴥ•ʔ
JetFormBuilder — Dynamic Blocks Form Builder / 3.6.5.1
JetFormBuilder — Dynamic Blocks Form Builder v3.6.5.1
3.6.5.1 3.6.5 3.6.4.2 3.6.4.1 3.6.4 3.6.3.1 3.6.3 3.6.2.2 3.6.2.1 3.6.2 3.6.1.1 3.6.1 3.6.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.10 2.1.11 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 3.0.0 3.0.0.1 3.0.0.2 3.0.0.3 3.0.1 3.0.1.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.0.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.3.1 3.3.4 3.3.4.1 3.3.4.2 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.5.1 3.4.5.2 3.4.6 3.4.7 3.4.7.1 3.5.0 3.5.1 3.5.1.1 3.5.1.2 3.5.2 3.5.2.1 3.5.3 3.5.4 3.5.5 3.5.6 3.5.6.1 3.5.6.2 3.5.6.3 3.6.0
jetformbuilder / vendor / woocommerce / action-scheduler / classes / ActionScheduler_RecurringActionScheduler.php
jetformbuilder / vendor / woocommerce / action-scheduler / classes Last commit date
WP_CLI 1 month ago abstracts 1 month ago actions 1 year ago data-stores 1 month ago migration 1 year ago schedules 1 year ago schema 1 month ago ActionScheduler_ActionClaim.php 1 year ago ActionScheduler_ActionFactory.php 1 year ago ActionScheduler_AdminView.php 1 year ago ActionScheduler_AsyncRequest_QueueRunner.php 1 year ago ActionScheduler_Compatibility.php 1 year ago ActionScheduler_DataController.php 1 month ago ActionScheduler_DateTime.php 1 year ago ActionScheduler_Exception.php 2 years ago ActionScheduler_FatalErrorMonitor.php 1 year ago ActionScheduler_InvalidActionException.php 1 year ago ActionScheduler_ListTable.php 1 year ago ActionScheduler_LogEntry.php 1 year ago ActionScheduler_NullLogEntry.php 1 year ago ActionScheduler_OptionLock.php 1 year ago ActionScheduler_QueueCleaner.php 1 year ago ActionScheduler_QueueRunner.php 1 year ago ActionScheduler_RecurringActionScheduler.php 1 month ago ActionScheduler_SystemInformation.php 1 year ago ActionScheduler_Versions.php 1 year ago ActionScheduler_WPCommentCleaner.php 1 year ago ActionScheduler_wcSystemStatus.php 1 month ago
ActionScheduler_RecurringActionScheduler.php
82 lines
1 <?php
2
3 /**
4 * Class ActionScheduler_RecurringActionScheduler
5 *
6 * This class ensures that the `action_scheduler_ensure_recurring_actions` hook is triggered on a daily interval. This
7 * simplifies the process for other plugins to register their recurring actions without requiring each plugin to query
8 * or schedule actions independently on every request.
9 */
10 class ActionScheduler_RecurringActionScheduler {
11
12 /**
13 * @var string The hook of the scheduled recurring action that is run to trigger the
14 * `action_scheduler_ensure_recurring_actions` hook that plugins should use. We can't directly have the
15 * scheduled action hook be the hook plugins should use because the actions will show as failed if no plugin
16 * was actively hooked into it.
17 */
18 private const RUN_SCHEDULED_RECURRING_ACTIONS_HOOK = 'action_scheduler_run_recurring_actions_schedule_hook';
19
20 /**
21 * Initialize the instance. Should only be run on a single instance per request.
22 *
23 * @return void
24 */
25 public function init(): void {
26 add_action( self::RUN_SCHEDULED_RECURRING_ACTIONS_HOOK, array( $this, 'run_recurring_scheduler_hook' ) );
27 if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
28 add_action( 'action_scheduler_init', array( $this, 'schedule_recurring_scheduler_hook' ) );
29 }
30 }
31
32 /**
33 * Schedule the recurring `action_scheduler_ensure_recurring_actions` action if not already scheduled.
34 *
35 * @return void
36 */
37 public function schedule_recurring_scheduler_hook(): void {
38 if ( false === wp_cache_get( 'as_is_ensure_recurring_actions_scheduled' ) ) {
39 if ( ! as_has_scheduled_action( self::RUN_SCHEDULED_RECURRING_ACTIONS_HOOK ) ) {
40 as_schedule_recurring_action(
41 time(),
42 DAY_IN_SECONDS,
43 self::RUN_SCHEDULED_RECURRING_ACTIONS_HOOK,
44 [],
45 'ActionScheduler',
46 true,
47 20
48 );
49 }
50 wp_cache_set( 'as_is_ensure_recurring_actions_scheduled', true, HOUR_IN_SECONDS );
51 }
52 }
53
54 /**
55 * Trigger the hook to allow other plugins to schedule their recurring actions.
56 *
57 * @return void
58 */
59 public function run_recurring_scheduler_hook(): void {
60 /**
61 * Fires to allow extensions to verify and ensure their recurring actions are scheduled.
62 *
63 * This action is scheduled to trigger once every 24 hrs for the purpose of having 3rd party plugins verify that
64 * any previously scheduled recurring actions are still scheduled. Because recurring actions could stop getting
65 * rescheduled by default due to excessive failures, database issues, or other interruptions, extensions can use
66 * this hook to check for the existence of their recurring actions and reschedule them if necessary.
67 *
68 * Example usage:
69 *
70 * add_action('action_scheduler_ensure_recurring_actions', function() {
71 * // Check if the recurring action is scheduled, and reschedule if missing.
72 * if ( ! as_has_scheduled_action('my_recurring_action') ) {
73 * as_schedule_recurring_action( time(), HOUR_IN_SECONDS, 'my_recurring_action' );
74 * }
75 * });
76 *
77 * @since 3.9.3
78 */
79 do_action( 'action_scheduler_ensure_recurring_actions' );
80 }
81 }
82