Automator_DB_Handler

Class Automator_DB_Handler


Source Source

File: src/core/lib/utilities/db/class-automator-db-handler.php

class Automator_DB_Handler {
	/**
	 * @var
	 */
	public static $instance;
	/**
	 * @var object
	 */
	public $tables;
	/**
	 * @var Automator_DB_Handler_Recipes
	 */
	public $recipe;
	/**
	 * @var Automator_DB_Handler_Triggers
	 */
	public $trigger;
	/**
	 * @var Automator_DB_Handler_Actions
	 */
	public $action;
	/**
	 * @var Automator_DB_Handler_Closures
	 */
	public $closure;
	/**
	 * @var Automator_DB_Handler_Tokens
	 */
	public $token;

	/**
	 * Automator_DB_Handler constructor.
	 */
	public function __construct() {
		$this->tables  = (object) apply_filters(
			'automator_database_tables',
			(object) array(
				'recipe'       => 'uap_recipe_log',
				'trigger'      => 'uap_trigger_log',
				'trigger_meta' => 'uap_trigger_log_meta',
				'action'       => 'uap_action_log',
				'action_meta'  => 'uap_action_log_meta',
				'closure'      => 'uap_closure_log',
				'closure_meta' => 'uap_closure_log_meta',
				'recipe_logs'  => 'uap_recipe_logs_view',
				'trigger_logs' => 'uap_trigger_logs_view',
				'action_logs'  => 'uap_action_logs_view',
			)
		);
		$this->recipe  = Automator_DB_Handler_Recipes::get_instance();
		$this->token   = Automator_DB_Handler_Tokens::get_instance();
		$this->trigger = Automator_DB_Handler_Triggers::get_instance();
		$this->action  = Automator_DB_Handler_Actions::get_instance();
		$this->closure = Automator_DB_Handler_Closures::get_instance();
	}

	/**
	 * @return Automator_DB_Handler
	 */
	public static function get_instance() {

		if ( null === self::$instance ) {
			self::$instance = new self();
		}

		return self::$instance;
	}

	/**
	 * @param string $table
	 * @param array $update
	 * @param array $where
	 * @param array $where_format
	 * @param array $update_format
	 *
	 * @return bool|int
	 */
	public function update( string $table, array $update, array $where, array $where_format, array $update_format ) {
		global $wpdb;

		return $wpdb->update(
			$table,
			$update,
			$where,
			$where_format,
			$update_format
		);
	}
}

Methods Methods


Top ↑

Changelog Changelog

Changelog
Version Description
3.0 Introduced.