HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: /var/www/html/ielts-store/wp-content/plugins/automatewoo/includes/Queue_Query.php
<?php
// phpcs:ignoreFile

namespace AutomateWoo;

if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * @class Queue_Query
 * @since 2.1.0
 */
class Queue_Query extends Query_Data_Layer_Abstract {

	/** @var string */
	public $table_id = 'queue';

	/** @var string  */
	protected $model = 'AutomateWoo\Queued_Event';

	/** @var string  */
	public $meta_table_id = 'queue-meta';


	/**
	 * @since 3.8
	 * @param int|array $workflow_id
	 * @param $compare bool|string - defaults to '=' or 'IN' if array
	 * @return $this
	 */
	function where_workflow( $workflow_id, $compare = false ) {
		return $this->where( 'workflow_id', $workflow_id, $compare );
	}


	/**
	 * @since 3.8
	 * @param string|DateTime $date
	 * @param $compare bool|string - defaults to '=' or 'IN' if array
	 * @return $this
	 */
	function where_date_due( $date, $compare = false ) {
		return $this->where( 'date', $date, $compare );
	}


	/**
	 * @since 3.8
	 * @param bool $failed
	 * @param $compare bool|string - defaults to '=' or 'IN' if array
	 * @return $this
	 */
	function where_failed( $failed, $compare = false ) {
		return $this->where( 'failed', absint( $failed ), $compare );
	}


	/**
	 * @since 3.8
	 * @param string|DateTime $date
	 * @param $compare bool|string - defaults to '=' or 'IN' if array
	 * @return $this
	 */
	function where_date_created( $date, $compare = false ) {
		return $this->where( 'created', $date, $compare );
	}


	/**
	 * @since 3.8
	 * @param $start_date
	 * @param $end_date
	 * @return $this
	 */
	function where_date_created_between( $start_date, $end_date ) {
		$this->where_date_created( $start_date, '>' );
		return $this->where_date_created( $end_date, '<' );
	}


	/**
	 * @since 4.0
	 * @param Customer $customer
	 * @param bool $include_guest_matches include matching guest results
	 * @param bool $include_advocate_matches
	 * @return $this
	 */
	function where_customer_or_legacy_user( $customer, $include_guest_matches = false, $include_advocate_matches = false ) {
		$where_meta = [];

		$where_meta[] = [
			'key' => $this->get_data_layer_meta_key( 'customer' ),
			'value' => $customer->get_id()
		];

		if ( $customer->is_registered() ) {
			$where_meta[] = [
				'key' => $this->get_data_layer_meta_key( 'user' ),
				'value' => $customer->get_user_id()
			];

			if ( $include_advocate_matches ) {
				$where_meta[] = [
					'key' => $this->get_data_layer_meta_key( 'advocate' ),
					'value' => $customer->get_user_id()
				];
			}
		}

		if ( $include_guest_matches ) {
			$where_meta[] = [
				'key' => $this->get_data_layer_meta_key( 'guest' ),
				'value' => $customer->get_email()
			];
		}

		$this->where_meta[] = $where_meta;
		return $this;
	}


	/**
	 * @since 3.8
	 * @param string $data_type
	 * @return string
	 */
	function get_data_layer_meta_key( $data_type ) {
		return Queue_Manager::get_data_layer_storage_key( $data_type );
	}


	/**
	 * @since 3.8
	 * @param string $data_type
	 * @param mixed $data_object
	 * @return string
	 */
	function get_data_layer_meta_value( $data_type, $data_object ) {
		return Queue_Manager::get_data_layer_storage_value( $data_type, $data_object );
	}


	/**
	 * @return Queued_Event[]
	 */
	function get_results() {
		return parent::get_results();
	}

}