ActionScheduler_DBLogger::bulk_log_cancel_actions()
Bulk add cancel action log entries.
Method of the class: ActionScheduler_DBLogger{}
No Hooks.
Return
null
. Nothing (null).
Usage
$ActionScheduler_DBLogger = new ActionScheduler_DBLogger(); $ActionScheduler_DBLogger->bulk_log_cancel_actions( $action_ids );
- $action_ids(array) (required)
- List of action ID.
ActionScheduler_DBLogger::bulk_log_cancel_actions() ActionScheduler DBLogger::bulk log cancel actions code WC 9.4.2
public function bulk_log_cancel_actions( $action_ids ) { if ( empty( $action_ids ) ) { return; } /** @var \wpdb $wpdb */ //phpcs:ignore Generic.Commenting.DocComment.MissingShort global $wpdb; $date = as_get_datetime_object(); $date_gmt = $date->format( 'Y-m-d H:i:s' ); ActionScheduler_TimezoneHelper::set_local_timezone( $date ); $date_local = $date->format( 'Y-m-d H:i:s' ); $message = __( 'action canceled', 'woocommerce' ); $format = '(%d, ' . $wpdb->prepare( '%s, %s, %s', $message, $date_gmt, $date_local ) . ')'; $sql_query = "INSERT {$wpdb->actionscheduler_logs} (action_id, message, log_date_gmt, log_date_local) VALUES "; $value_rows = array(); foreach ( $action_ids as $action_id ) { $value_rows[] = $wpdb->prepare( $format, $action_id ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared } $sql_query .= implode( ',', $value_rows ); $wpdb->query( $sql_query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared }