| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | /** |
| 12 | 12 | * Class DataBase |
| 13 | 13 | * |
| 14 | 14 | * @since 4.2.9.3 |
| 15 | - * @version 1.0.0 | |
| 15 | + * @version 1.0.1 | |
| 16 | 16 | */ |
| 17 | 17 | class DataBase { |
| 18 | 18 | private static $_instance; |
| 19 | 19 | public $wpdb, $tb_users; |
| @@ -31,8 +31,9 @@ | ||
| 31 | 31 | public $tb_lp_sessions; |
| 32 | 32 | public $tb_lp_files; |
| 33 | 33 | public $tb_lp_webhooks; |
| 34 | 34 | public $tb_thim_cache; |
| 35 | + public $tb_lp_mcp_api_keys; | |
| 35 | 36 | private $collate = ''; |
| 36 | 37 | public $max_index_length = '191'; |
| 37 | 38 | |
| 38 | 39 | protected function __construct() { |
| @@ -65,8 +66,9 @@ | ||
| 65 | 66 | $this->tb_lp_sessions = $prefix . 'learnpress_sessions'; |
| 66 | 67 | $this->tb_lp_files = $prefix . 'learnpress_files'; |
| 67 | 68 | $this->tb_lp_webhooks = $prefix . 'learnpress_webhooks'; |
| 68 | 69 | $this->tb_thim_cache = $prefix . 'thim_cache'; |
| 70 | + $this->tb_lp_mcp_api_keys = $prefix . 'learnpress_mcp_api_keys'; | |
| 69 | 71 | $this->wpdb->hide_errors(); |
| 70 | 72 | $this->set_collate(); |
| 71 | 73 | } |
| 72 | 74 | |
| @@ -108,11 +110,16 @@ | ||
| 108 | 110 | * |
| 109 | 111 | * @param string $name_table |
| 110 | 112 | * |
| 111 | 113 | * @return bool|int |
| 114 | + * @throws Exception | |
| 112 | 115 | */ |
| 113 | 116 | public function check_table_exists( string $name_table ) { |
| 114 | - return $this->wpdb->query( $this->wpdb->prepare( "SHOW TABLES LIKE '%s'", $name_table ) ); | |
| 117 | + return $this->wpdb->query( | |
| 118 | + $this->wpdb->prepare( | |
| 119 | + "SHOW TABLES LIKE '%s'", $name_table | |
| 120 | + ) | |
| 121 | + ); | |
| 115 | 122 | } |
| 116 | 123 | |
| 117 | 124 | /** |
| 118 | 125 | * Clone table |
| @@ -154,8 +161,9 @@ | ||
| 154 | 161 | * @return bool|int |
| 155 | 162 | */ |
| 156 | 163 | public function check_col_table( string $name_table = '', string $name_col = '' ) { |
| 157 | 164 | $query = $this->wpdb->prepare( "SHOW COLUMNS FROM $name_table LIKE '%s'", $name_col ); |
| 165 | + //$query = $this->wpdb->prepare( "SHOW COLUMNS FROM $name_table WHERE Field = '%s'", $name_col ); | |
| 158 | 166 | |
| 159 | 167 | return $this->wpdb->query( $query ); |
| 160 | 168 | } |
| 161 | 169 | |