Claim ID. * * @return int[] */ public function find_actions_by_claim_id( $claim_id ) { /** @var \wpdb $wpdb */ global $wpdb; $sql = "SELECT action_id FROM {$wpdb->actionscheduler_actions} WHERE claim_id=%d"; $sql = $wpdb->prepare( $sql, $claim_id ); $action_ids = $wpdb->get_col( $sql ); return array_map( 'intval', $action_ids ); } /** * Release actions from a claim and delete the claim. * * @param ActionScheduler_ActionClaim $claim Claim object. */ public function release_claim( ActionScheduler_ActionClaim $claim ) { /** @var \wpdb $wpdb */ global $wpdb; $wpdb->update( $wpdb->actionscheduler_actions, [ 'claim_id' => 0 ], [ 'claim_id' => $claim->get_id() ], [ '%d' ], [ '%d' ] ); $wpdb->delete( $wpdb->actionscheduler_claims, [ 'claim_id' => $claim->get_id() ], [ '%d' ] ); } /** * Remove the claim from an action. * * @param int $action_id Action ID. * * @return void */ public function unclaim_action( $action_id ) { /** @var \wpdb $wpdb */ global $wpdb; $wpdb->update( $wpdb->actionscheduler_actions, [ 'claim_id' => 0 ], [ 'action_id' => $action_id ], [ '%s' ], [ '%d' ] ); } /** * Mark an action as failed. * * @param int $action_id Action ID. */ public function mark_failure( $action_id ) { /** @var \wpdb $wpdb */ global $wpdb; $updated = $wpdb->update( $wpdb->actionscheduler_actions, [ 'status' => self::STATUS_FAILED ], [ 'action_id' => $action_id ], [ '%s' ], [ '%d' ] ); if ( empty( $updated ) ) { throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'woocommerce' ), $action_id ) ); } } /** * Add execution message to action log. * * @param int $action_id Action ID. * * @return void */ public function log_execution( $action_id ) { /** @var \wpdb $wpdb */ global $wpdb; $sql = "UPDATE {$wpdb->actionscheduler_actions} SET attempts = attempts+1, status=%s, last_attempt_gmt = %s, last_attempt_local = %s WHERE action_id = %d"; $sql = $wpdb->prepare( $sql, self::STATUS_RUNNING, current_time( 'mysql', true ), current_time( 'mysql' ), $action_id ); $wpdb->query( $sql ); } /** * Mark an action as complete. * * @param int $action_id Action ID. * * @return void */ public function mark_complete( $action_id ) { /** @var \wpdb $wpdb */ global $wpdb; $updated = $wpdb->update( $wpdb->actionscheduler_actions, [ 'status' => self::STATUS_COMPLETE, 'last_attempt_gmt' => current_time( 'mysql', true ), 'last_attempt_local' => current_time( 'mysql' ), ], [ 'action_id' => $action_id ], [ '%s' ], [ '%d' ] ); if ( empty( $updated ) ) { throw new \InvalidArgumentException( sprintf( __( 'Unidentified action %s', 'woocommerce' ), $action_id ) ); } } /** * Get an action's status. * * @param int $action_id Action ID. * * @return string */ public function get_status( $action_id ) { /** @var \wpdb $wpdb */ global $wpdb; $sql = "SELECT status FROM {$wpdb->actionscheduler_actions} WHERE action_id=%d"; $sql = $wpdb->prepare( $sql, $action_id ); $status = $wpdb->get_var( $sql ); if ( $status === null ) { throw new \InvalidArgumentException( __( 'Invalid action ID. No status found.', 'woocommerce' ) ); } elseif ( empty( $status ) ) { throw new \RuntimeException( __( 'Unknown status found for action.', 'woocommerce' ) ); } else { return $status; } } }
Fatal error: Uncaught Error: Class 'ActionScheduler_DBStore' not found in /home/payon/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler_Store.php:341 Stack trace: #0 /home/payon/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler.php(25): ActionScheduler_Store::instance() #1 /home/payon/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler.php(145): ActionScheduler::store() #2 /home/payon/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/action-scheduler.php(44): ActionScheduler::init('/home/payon/pub...') #3 /home/payon/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/ActionScheduler_Versions.php(59): action_scheduler_initialize_3_dot_1_dot_6() #4 /home/payon/public_html/wp-includes/class-wp-hook.php(306): ActionScheduler_Versions::initialize_latest_version() #5 /home/payon/public_html/wp-includes/class-wp-hook.php(332): WP_ in /home/payon/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/abstracts/ActionScheduler_Store.php on line 341