PluginProbe
WP Crontrol / trunk
WP Crontrol vtrunk
1.21.2 trunk 0.1 0.2 0.3 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.1 1.10.0 1.11.0 1.12.0 1.12.1 1.13.0 1.13.1 1.13.2 1.14.0 1.15.0 1.15.1 1.15.2 1.15.3 1.16.0 1.16.1 1.16.2 All 57 releases
wp-crontrol / src / Event / ActionSchedulerEvent.php

ActionSchedulerEvent.php in WP Crontrol trunk, at src/Event/ActionSchedulerEvent.php

57 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Represents an Action Scheduler cron event.
4 */
5
6 namespace Crontrol\Event;
7
8 use Crontrol\Context\UserContext;
9 use Crontrol\Context\FeatureContext;
10
11 use function Crontrol\json_output;
12
13 /**
14 * Represents an Action Scheduler cron event.
15 */
16 final class ActionSchedulerEvent extends Event {
17 /**
18 * The hook name for Action Scheduler events.
19 */
20 public const HOOK_NAME = 'action_scheduler_run_queue';
21
22 #[\Override]
23 public function editable( UserContext $user, FeatureContext $features ): bool {
24 return $user->can_edit_standard_cron_events();
25 }
26
27 #[\Override]
28 public function runnable( UserContext $user, FeatureContext $features ): bool {
29 return $user->can_run_standard_cron_events()
30 && ! $this->has_error()
31 && ! $this->is_paused();
32 }
33
34 #[\Override]
35 public function deletable( UserContext $user, FeatureContext $features ): bool {
36 return $user->can_delete_standard_cron_events();
37 }
38
39 #[\Override]
40 public function pausable(): bool {
41 return true;
42 }
43
44 #[\Override]
45 public function get_args_display(): string {
46 if ( empty( $this->args ) ) {
47 return '';
48 }
49 return json_output( $this->args, false );
50 }
51
52 #[\Override]
53 public function is_enabled( FeatureContext $features ): bool {
54 return true;
55 }
56 }
57