/
class-automator-db-handler.php
executable file
·111 lines (103 loc) · 2.49 KB
/
class-automator-db-handler.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
namespace Uncanny_Automator;
/**
* Class Automator_DB_Handler
*
* @since 3.0
* @package Uncanny_Automator
*/
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;
/**
* @var Automator_DB_Handler_Api
*/
public $api;
/**
* Automator_DB_Handler constructor.
*/
public function __construct() {
$this->tables = (object) apply_filters(
'automator_database_tables',
(object) array(
'recipe' => 'uap_recipe_log',
'recipe_meta' => 'uap_recipe_log_meta',
'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',
'api' => 'uap_api_log',
'api_meta' => 'uap_api_log_meta',
'recipe_logs' => 'uap_recipe_logs_view',
'trigger_logs' => 'uap_trigger_logs_view',
'action_logs' => 'uap_action_logs_view',
'api_logs' => 'uap_api_logs_view',
'api_response_logs' => 'uap_api_log_response',
'tokens_logs' => 'uap_tokens_log',
'recipe_count' => 'uap_recipe_count',
)
);
$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();
$this->api = Automator_DB_Handler_Api::get_instance();
}
/**
* @return Automator_DB_Handler
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* @param $table
* @param $update
* @param $where
* @param $where_format
* @param $update_format
*
* @return bool|int
*/
public function update( $table, $update, $where, $where_format, $update_format ) {
global $wpdb;
return $wpdb->update(
$table,
$update,
$where,
$where_format,
$update_format
);
}
}