Automator_DB::is_view_exists( string $type = 'recipe' )

Check if specific VIEW is missing.


Parameters Parameters

$type

(string) (Optional)

Default value: 'recipe'


Top ↑

Return Return

(bool)


Source Source

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

	public static function is_view_exists( string $type = 'recipe' ) {
		global $wpdb;
		$recipe_view = '';
		if ( 'recipe' === $type ) {
			$recipe_view = "{$wpdb->prefix}uap_recipe_logs_view";
		}
		if ( 'trigger' === $type ) {
			$recipe_view = "{$wpdb->prefix}uap_trigger_logs_view";
		}
		if ( 'action' === $type ) {
			$recipe_view = "{$wpdb->prefix}uap_action_logs_view";
		}

		if ( empty( $recipe_view ) ) {
			return false;
		}
		$results = self::all_views( true );
		if ( ! in_array( $recipe_view, $results, true ) ) {
			return true;
		}

		return false;
	}