| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | * |
| 11 | 11 | * @param string $hook The hook to trigger. |
| 12 | 12 | * @param array $args Arguments to pass when the hook triggers. |
| 13 | 13 | * @param string $group The group to assign this job to. |
| 14 | - * @param bool $unique Whether the action should be unique. | |
| 14 | + * @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters. | |
| 15 | 15 | * @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255. |
| 16 | 16 | * |
| 17 | 17 | * @return int The action ID. Zero if there was an error scheduling the action. |
| 18 | 18 | */ |
| @@ -34,10 +34,11 @@ | ||
| 34 | 34 | * @param string $hook Action hook. |
| 35 | 35 | * @param array $args Action arguments. |
| 36 | 36 | * @param string $group Action group. |
| 37 | 37 | * @param int $priority Action priority. |
| 38 | + * @param bool $unique Unique action. | |
| 38 | 39 | */ |
| 39 | - $pre = apply_filters( 'pre_as_enqueue_async_action', null, $hook, $args, $group, $priority ); | |
| 40 | + $pre = apply_filters( 'pre_as_enqueue_async_action', null, $hook, $args, $group, $priority, $unique ); | |
| 40 | 41 | if ( null !== $pre ) { |
| 41 | 42 | return is_int( $pre ) ? $pre : 0; |
| 42 | 43 | } |
| 43 | 44 | |
| @@ -59,9 +60,9 @@ | ||
| 59 | 60 | * @param int $timestamp When the job will run. |
| 60 | 61 | * @param string $hook The hook to trigger. |
| 61 | 62 | * @param array $args Arguments to pass when the hook triggers. |
| 62 | 63 | * @param string $group The group to assign this job to. |
| 63 | - * @param bool $unique Whether the action should be unique. | |
| 64 | + * @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters. | |
| 64 | 65 | * @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255. |
| 65 | 66 | * |
| 66 | 67 | * @return int The action ID. Zero if there was an error scheduling the action. |
| 67 | 68 | */ |
| @@ -111,9 +112,9 @@ | ||
| 111 | 112 | * @param int $interval_in_seconds How long to wait between runs. |
| 112 | 113 | * @param string $hook The hook to trigger. |
| 113 | 114 | * @param array $args Arguments to pass when the hook triggers. |
| 114 | 115 | * @param string $group The group to assign this job to. |
| 115 | - * @param bool $unique Whether the action should be unique. | |
| 116 | + * @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters. | |
| 116 | 117 | * @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255. |
| 117 | 118 | * |
| 118 | 119 | * @return int The action ID. Zero if there was an error scheduling the action. |
| 119 | 120 | */ |
| @@ -125,8 +126,9 @@ | ||
| 125 | 126 | $interval = (int) $interval_in_seconds; |
| 126 | 127 | |
| 127 | 128 | // We expect an integer and allow it to be passed using float and string types, but otherwise |
| 128 | 129 | // should reject unexpected values. |
| 130 | + // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison | |
| 129 | 131 | if ( ! is_numeric( $interval_in_seconds ) || $interval_in_seconds != $interval ) { |
| 130 | 132 | _doing_it_wrong( |
| 131 | 133 | __METHOD__, |
| 132 | 134 | sprintf( |
| @@ -196,9 +198,9 @@ | ||
| 196 | 198 | * +------------------------- min (0 - 59) |
| 197 | 199 | * @param string $hook The hook to trigger. |
| 198 | 200 | * @param array $args Arguments to pass when the hook triggers. |
| 199 | 201 | * @param string $group The group to assign this job to. |
| 200 | - * @param bool $unique Whether the action should be unique. | |
| 202 | + * @param bool $unique Whether the action should be unique. It will not be scheduled if another pending or running action has the same hook and group parameters. | |
| 201 | 203 | * @param int $priority Lower values take precedence over higher values. Defaults to 10, with acceptable values falling in the range 0-255. |
| 202 | 204 | * |
| 203 | 205 | * @return int The action ID. Zero if there was an error scheduling the action. |
| 204 | 206 | */ |
| @@ -454,9 +456,9 @@ | ||
| 454 | 456 | foreach ( $ids as $action_id ) { |
| 455 | 457 | $actions[ $action_id ] = $store->fetch_action( $action_id ); |
| 456 | 458 | } |
| 457 | 459 | |
| 458 | - if ( ARRAY_A == $return_format ) { | |
| 460 | + if ( ARRAY_A === $return_format ) { | |
| 459 | 461 | foreach ( $actions as $action_id => $action_object ) { |
| 460 | 462 | $actions[ $action_id ] = get_object_vars( $action_object ); |
| 461 | 463 | } |
| 462 | 464 | } |