PluginProbe ʕ •ᴥ•ʔ
Hostinger Reach – AI-Powered Email Marketing for WordPress / trunk
Hostinger Reach – AI-Powered Email Marketing for WordPress vtrunk
1.7.2 1.7.1 1.7.0 1.6.0 1.5.9 1.5.8 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 1.5.2 1.5.1 1.5.0 1.4.12 1.4.11 1.4.10 1.4.9 1.4.8 1.4.7 trunk 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6
hostinger-reach / src / Setup / Database.php
hostinger-reach / src / Setup Last commit date
Activator.php 4 months ago Assets.php 3 weeks ago Blocks.php 1 year ago Database.php 10 months ago Encrypt.php 9 months ago
Database.php
39 lines
1 <?php
2
3 namespace Hostinger\Reach\Setup;
4
5 use Hostinger\Reach\Admin\Database\DatabaseTable;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 die;
9 }
10
11 class Database {
12
13 /** @var DatabaseTable[] */
14 private array $tables;
15
16 public function __construct( array $tables ) {
17 $this->tables = $tables;
18 }
19
20 public function init(): void {
21 $db_version_option = HOSTINGER_REACH_PLUGIN_SLUG . '-db-version';
22 $database_version = get_option(
23 $db_version_option,
24 ''
25 );
26
27 if ( $database_version !== HOSTINGER_REACH_DB_VERSION ) {
28 $this->create_tables();
29 update_option( $db_version_option, HOSTINGER_REACH_DB_VERSION, false );
30 }
31 }
32
33 private function create_tables(): void {
34 foreach ( $this->tables as $table ) {
35 $table->create();
36 }
37 }
38 }
39