| @@ -17,8 +17,23 @@ | ||
| 17 | 17 | $model->updated_at = current_time('mysql'); |
| 18 | 18 | }); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | + /** | |
| 22 | + * The table is created when an AI integration is first turned on, not on | |
| 23 | + * activation, so readers check for it first. | |
| 24 | + * | |
| 25 | + * @return bool | |
| 26 | + */ | |
| 27 | + public static function tableExists() | |
| 28 | + { | |
| 29 | + global $wpdb; | |
| 30 | + | |
| 31 | + $table = $wpdb->prefix . 'fs_ai_activity_logs'; | |
| 32 | + | |
| 33 | + return $wpdb->get_var($wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($table))) === $table; | |
| 34 | + } | |
| 35 | + | |
| 21 | 36 | public function person() |
| 22 | 37 | { |
| 23 | 38 | $class = __NAMESPACE__ . '\Person'; |
| 24 | 39 | |