Automator_DB::api_log_view_query()


Parameters Parameters

$group_by

(Required)


Top ↑

Return Return

(string)


Source Source

File: src/core/class-automator-db.php

	public static function api_log_view_query() {
		global $wpdb;
		$qry = "SELECT
				api.ID,
				api.date_time AS date,
				u.user_email,
				u.display_name,
				u.ID AS user_id,
				pr.post_title AS recipe_title,
				rl.automator_recipe_id,
				al.automator_recipe_log_id AS recipe_log_id,
				rl.date_time AS recipe_date_time,
				rl.completed AS recipe_completed,
				rl.run_number AS recipe_run_number,
				pa.post_title AS title,
				asen.meta_value AS sentence,
				al.automator_action_id as item_id,
				al.completed AS completed,
				al.error_message as error_message,
				api.type,
				api.item_log_id,
				api.status,
				api.params,
				api.price,
				api.balance,
				api.notes,
				api.time_spent,
				api.endpoint
				FROM {$wpdb->prefix}uap_api_log api
				LEFT JOIN {$wpdb->prefix}uap_action_log al
				ON al.ID = api.item_log_id
				LEFT JOIN {$wpdb->prefix}uap_recipe_log rl
				ON al.automator_recipe_log_id = rl.ID
				LEFT JOIN {$wpdb->posts} pr
				ON pr.ID = al.automator_recipe_id
				JOIN {$wpdb->posts} pa
				ON pa.ID = al.automator_action_id
				LEFT JOIN {$wpdb->prefix}uap_action_log_meta asen
				ON asen.automator_action_log_id = al.ID AND asen.meta_key = 'sentence_human_readable_html'
				LEFT JOIN {$wpdb->users} u
				ON al.user_id = u.ID
				WHERE api.type = 'action'
				UNION SELECT
				api.ID,
				api.date_time AS date,
				u.user_email,
				u.display_name,
				u.ID AS user_id,
				pr.post_title AS recipe_title,
				rl.automator_recipe_id,
				tl.automator_recipe_log_id as recipe_log_id,
				rl.date_time AS recipe_date_time,
				rl.completed AS recipe_completed,
				rl.run_number AS recipe_run_number,
				pt.post_title AS title,
				tsen.meta_value AS sentence,
				tl.automator_trigger_id as item_id,
				tl.completed AS completed,
				'' as error_message,
				api.type,
				api.item_log_id,
				api.status,
				api.params,
				api.price,
				api.balance,
				api.notes,
				api.time_spent,
				api.endpoint
				FROM {$wpdb->prefix}uap_api_log api
				LEFT JOIN {$wpdb->prefix}uap_trigger_log tl
				ON tl.ID = api.item_log_id
				LEFT JOIN {$wpdb->prefix}uap_recipe_log rl
				ON tl.automator_recipe_log_id = rl.ID
				LEFT JOIN {$wpdb->posts} pr
				ON pr.ID = tl.automator_recipe_id
				JOIN {$wpdb->posts} pt
				ON pt.ID = tl.automator_trigger_id
				LEFT JOIN {$wpdb->prefix}uap_trigger_log_meta tsen
				ON tsen.automator_trigger_log_id = tl.ID AND tsen.meta_key = 'sentence_human_readable'
				LEFT JOIN {$wpdb->users} u
				ON tl.user_id = u.ID
				WHERE api.type = 'trigger'";
		return apply_filters(
			'automator_api_log_view_query',
			$qry
		);
	}