WP_Background_Process::is_queue_empty()protectedWC 1.0

Is queue empty

Method of the class: WP_Background_Process{}

No Hooks.

Return

true|false.

Usage

// protected - for code of main (parent) or child class
$result = $this->is_queue_empty();

WP_Background_Process::is_queue_empty() code WC 9.4.2

protected function is_queue_empty() {
	global $wpdb;

	$table  = $wpdb->options;
	$column = 'option_name';

	if ( is_multisite() ) {
		$table  = $wpdb->sitemeta;
		$column = 'meta_key';
	}

	$key = $this->identifier . '_batch_%';

	$count = $wpdb->get_var( $wpdb->prepare( "
		SELECT COUNT(*)
		FROM {$table}
		WHERE {$column} LIKE %s
	", $key ) );

	return ! ( $count > 0 );
}