Sin descripción

Database.php 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace MailPoet\Config;
  3. if (!defined('ABSPATH')) exit;
  4. use MailPoetVendor\Idiorm\ORM;
  5. use PDO;
  6. class Database {
  7. public function init(PDO $pdo) {
  8. ORM::setDb($pdo);
  9. $this->setupLogging();
  10. $this->defineTables();
  11. }
  12. public function setupLogging() {
  13. ORM::configure('logging', WP_DEBUG);
  14. }
  15. public function defineTables() {
  16. if (!defined('MP_SETTINGS_TABLE')) {
  17. define('MP_SETTINGS_TABLE', Env::$dbPrefix . 'settings');
  18. define('MP_SEGMENTS_TABLE', Env::$dbPrefix . 'segments');
  19. define('MP_FORMS_TABLE', Env::$dbPrefix . 'forms');
  20. define('MP_CUSTOM_FIELDS_TABLE', Env::$dbPrefix . 'custom_fields');
  21. define('MP_SUBSCRIBERS_TABLE', Env::$dbPrefix . 'subscribers');
  22. define('MP_SUBSCRIBER_SEGMENT_TABLE', Env::$dbPrefix . 'subscriber_segment');
  23. define('MP_SUBSCRIBER_CUSTOM_FIELD_TABLE', Env::$dbPrefix . 'subscriber_custom_field');
  24. define('MP_SUBSCRIBER_IPS_TABLE', Env::$dbPrefix . 'subscriber_ips');
  25. define('MP_NEWSLETTER_SEGMENT_TABLE', Env::$dbPrefix . 'newsletter_segment');
  26. define('MP_SCHEDULED_TASKS_TABLE', Env::$dbPrefix . 'scheduled_tasks');
  27. define('MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE', Env::$dbPrefix . 'scheduled_task_subscribers');
  28. define('MP_SENDING_QUEUES_TABLE', Env::$dbPrefix . 'sending_queues');
  29. define('MP_NEWSLETTERS_TABLE', Env::$dbPrefix . 'newsletters');
  30. define('MP_NEWSLETTER_TEMPLATES_TABLE', Env::$dbPrefix . 'newsletter_templates');
  31. define('MP_NEWSLETTER_OPTION_FIELDS_TABLE', Env::$dbPrefix . 'newsletter_option_fields');
  32. define('MP_NEWSLETTER_OPTION_TABLE', Env::$dbPrefix . 'newsletter_option');
  33. define('MP_NEWSLETTER_LINKS_TABLE', Env::$dbPrefix . 'newsletter_links');
  34. define('MP_NEWSLETTER_POSTS_TABLE', Env::$dbPrefix . 'newsletter_posts');
  35. define('MP_STATISTICS_NEWSLETTERS_TABLE', Env::$dbPrefix . 'statistics_newsletters');
  36. define('MP_STATISTICS_CLICKS_TABLE', Env::$dbPrefix . 'statistics_clicks');
  37. define('MP_STATISTICS_OPENS_TABLE', Env::$dbPrefix . 'statistics_opens');
  38. define('MP_STATISTICS_UNSUBSCRIBES_TABLE', Env::$dbPrefix . 'statistics_unsubscribes');
  39. define('MP_STATISTICS_FORMS_TABLE', Env::$dbPrefix . 'statistics_forms');
  40. define('MP_STATISTICS_WOOCOMMERCE_PURCHASES_TABLE', Env::$dbPrefix . 'statistics_woocommerce_purchases');
  41. define('MP_MAPPING_TO_EXTERNAL_ENTITIES_TABLE', Env::$dbPrefix . 'mapping_to_external_entities');
  42. define('MP_LOG_TABLE', Env::$dbPrefix . 'log');
  43. define('MP_STATS_NOTIFICATIONS_TABLE', Env::$dbPrefix . 'stats_notifications');
  44. define('MP_USER_FLAGS_TABLE', Env::$dbPrefix . 'user_flags');
  45. define('MP_FEATURE_FLAGS_TABLE', Env::$dbPrefix . 'feature_flags');
  46. define('MP_DYNAMIC_SEGMENTS_FILTERS_TABLE', Env::$dbPrefix . 'dynamic_segment_filters');
  47. }
  48. }
  49. }