Automator_Get_Data::completed_runs( mixed $seconds_to_include = null )

completed_runs


Parameters Parameters

$seconds_to_include

(Optional)

Default value: null


Top ↑

Return Return

(void)


Source Source

File: src/core/lib/utilities/class-automator-get-data.php

	public function completed_runs( $seconds_to_include = null ) {
		global $wpdb;
		$tbl   = Automator()->db->tables->recipe;
		$query = "SELECT COUNT(*) FROM {$wpdb->prefix}{$tbl} WHERE completed=1";
		if ( null !== $seconds_to_include ) {
			$timestamp = current_time( 'timestamp' );
			$time_ago  = strtotime( "-$seconds_to_include Seconds", $timestamp );
			$date      = date_i18n( 'Y-m-d H:i:s', $time_ago );
			$query     .= " AND date_time >= '$date'";
		}
		$results = $wpdb->get_var( $query ); //phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
		return apply_filters( 'automator_completed_runs', absint( $results ) );
	}