ActionScheduler_wpPostStore::mark_complete() – Record that an action was completed.

You appear to be a bot. Output may be restricted

Description

Record that an action was completed.

Usage

ActionScheduler_wpPostStore::mark_complete( $action_id );

Parameters

$action_id
( int ) required – ID of the completed action.

Returns

void

Source

File name: woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_wpPostStore.php
Lines:

1 to 17 of 17
  public function mark_complete( $action_id ) {
    $post = get_post( $action_id );
    if ( empty( $post ) || ( $post->post_type != self::POST_TYPE ) ) {
      throw new InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'woocommerce' ), $action_id ) );
    }
    add_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10, 1 );
    add_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10, 5 );
    $result = wp_update_post(array(
      'ID' => $action_id,
      'post_status' => 'publish',
    ), TRUE);
    remove_filter( 'wp_insert_post_data', array( $this, 'filter_insert_post_data' ), 10 );
    remove_filter( 'pre_wp_unique_post_slug', array( $this, 'set_unique_post_slug' ), 10 );
    if ( is_wp_error( $result ) ) {
      throw new RuntimeException( $result->get_error_message() );
    }
  }
 

 View on GitHub View on Trac