Set array keys on scheduled webhook action

To make it clearer in the database what the args refer to, e.g.
instead of storing the scheduled action's args as:

[1,123]

This patch changes it so that the args are stored as:

["webhook_id":1,"arg":123]

This has no impact on callbacks on the hooks, they are still passed
the args as normal.
This commit is contained in:
Brent Shepherd 2018-05-10 13:59:22 +10:00
parent 9aee2fa97b
commit 3993126f78
1 changed files with 1 additions and 1 deletions

View File

@ -21,7 +21,7 @@ function wc_webhook_process_delivery( $webhook, $arg ) {
// user who triggered it.
if ( apply_filters( 'woocommerce_webhook_deliver_async', true, $webhook, $arg ) ) {
// Deliver in background.
wc_schedule_single_action( time(), 'woocommerce_deliver_webhook_async', array( $webhook->get_id(), $arg ), 'woocommerce-webhooks' );
wc_schedule_single_action( time(), 'woocommerce_deliver_webhook_async', array( 'webhook_id' => $webhook->get_id(), 'arg' => $arg ), 'woocommerce-webhooks' );
} else {
// Deliver immediately.
$webhook->deliver( $arg );