PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / 1.7.0
Hostinger Reach – AI-Powered Email Marketing for WordPress v1.7.0
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / vendor / woocommerce / action-scheduler / classes / WP_CLI / Action / Next_Command.php
hostinger-reach / vendor / woocommerce / action-scheduler / classes / WP_CLI / Action Last commit date
Cancel_Command.php 10 months ago Create_Command.php 10 months ago Delete_Command.php 10 months ago Generate_Command.php 10 months ago Get_Command.php 10 months ago List_Command.php 10 months ago Next_Command.php 10 months ago Run_Command.php 10 months ago
Next_Command.php
72 lines
1 <?php
2
3 namespace Action_Scheduler\WP_CLI\Action;
4
5 // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaping output is not necessary in WP CLI.
6
7 use function \WP_CLI\Utils\get_flag_value;
8
9 /**
10 * WP-CLI command: action-scheduler action next
11 */
12 class Next_Command extends \ActionScheduler_WPCLI_Command {
13
14 /**
15 * Execute command.
16 *
17 * @return void
18 */
19 public function execute() {
20 $hook = $this->args[0];
21 $group = get_flag_value( $this->assoc_args, 'group', '' );
22 $callback_args = get_flag_value( $this->assoc_args, 'args', null );
23 $raw = (bool) get_flag_value( $this->assoc_args, 'raw', false );
24
25 if ( ! empty( $callback_args ) ) {
26 $callback_args = json_decode( $callback_args, true );
27 }
28
29 if ( $raw ) {
30 \WP_CLI::line( as_next_scheduled_action( $hook, $callback_args, $group ) );
31 return;
32 }
33
34 $params = array(
35 'hook' => $hook,
36 'orderby' => 'date',
37 'order' => 'ASC',
38 'group' => $group,
39 );
40
41 if ( is_array( $callback_args ) ) {
42 $params['args'] = $callback_args;
43 }
44
45 $params['status'] = \ActionScheduler_Store::STATUS_RUNNING;
46 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
47 \WP_CLI::debug( 'ActionScheduler()::store()->query_action( ' . var_export( $params, true ) . ' )' );
48
49 $store = \ActionScheduler::store();
50 $action_id = $store->query_action( $params );
51
52 if ( $action_id ) {
53 echo $action_id;
54 return;
55 }
56
57 $params['status'] = \ActionScheduler_Store::STATUS_PENDING;
58 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_var_export
59 \WP_CLI::debug( 'ActionScheduler()::store()->query_action( ' . var_export( $params, true ) . ' )' );
60
61 $action_id = $store->query_action( $params );
62
63 if ( $action_id ) {
64 echo $action_id;
65 return;
66 }
67
68 \WP_CLI::warning( 'No matching next action.' );
69 }
70
71 }
72