| @@ -1,12 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Texty; |
| 4 | 4 | |
| 5 | -use Texty\Models\SmsStat; | |
| 6 | -use Texty\Models\SmsStatStore; | |
| 7 | -use Texty\Dependencies\WeDevs\WPKit\DataLayer\DataLayerFactory; | |
| 8 | - | |
| 9 | 5 | /** |
| 10 | 6 | * Installer Class |
| 11 | 7 | */ |
| 12 | 8 | class Install { |
| @@ -14,9 +10,8 @@ | ||
| 14 | 10 | /** |
| 15 | 11 | * Run the isntaller |
| 16 | 12 | */ |
| 17 | 13 | public function run() { |
| 18 | - $this->create_tables(); | |
| 19 | 14 | $installed = get_option( 'texty_installed' ); |
| 20 | 15 | |
| 21 | 16 | if ( ! $installed ) { |
| 22 | 17 | update_option( 'texty_installed', time() ); |
| @@ -22,47 +17,6 @@ | ||
| 22 | 17 | update_option( 'texty_installed', time() ); |
| 23 | 18 | } |
| 24 | 19 | |
| 25 | 20 | update_option( 'texty_version', TEXTY_VERSION ); |
| 26 | - | |
| 27 | - // Seed the schema version so the migration runner skips migrations | |
| 28 | - // whose changes are already baked into create_tables() above. The | |
| 29 | - // upgrade path on existing installs (where this option is missing or | |
| 30 | - // older) is handled by Texty\Migrations on plugins_loaded. | |
| 31 | - if ( ! get_option( 'texty_db_version' ) ) { | |
| 32 | - update_option( 'texty_db_version', TEXTY_VERSION ); | |
| 33 | - } | |
| 34 | - } | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * Create database tables | |
| 38 | - * | |
| 39 | - * @return void | |
| 40 | - */ | |
| 41 | - public function create_tables() { | |
| 42 | - global $wpdb; | |
| 43 | - | |
| 44 | - require_once ABSPATH . 'wp-admin/includes/upgrade.php'; | |
| 45 | - | |
| 46 | - $charset_collate = $wpdb->get_charset_collate(); | |
| 47 | - $table_name = $wpdb->prefix . 'texty_sms_stat'; | |
| 48 | - | |
| 49 | - $sql = "CREATE TABLE IF NOT EXISTS {$table_name} ( | |
| 50 | - id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| 51 | - receiver VARCHAR(20) NOT NULL, | |
| 52 | - gateway VARCHAR(50) NOT NULL, | |
| 53 | - status VARCHAR(20) DEFAULT NULL, | |
| 54 | - notification_id VARCHAR(64) DEFAULT NULL, | |
| 55 | - notification_group VARCHAR(32) DEFAULT NULL, | |
| 56 | - message TEXT NULL, | |
| 57 | - response LONGTEXT NULL, | |
| 58 | - created_at DATETIME NOT NULL, | |
| 59 | - updated_at DATETIME NOT NULL, | |
| 60 | - reference_id VARCHAR(100) DEFAULT NULL, | |
| 61 | - KEY created_at_idx (created_at), | |
| 62 | - KEY notification_id_idx (notification_id), | |
| 63 | - KEY status_idx (status) | |
| 64 | - ) {$charset_collate};"; | |
| 65 | - | |
| 66 | - dbDelta( $sql ); | |
| 67 | 21 | } |
| 68 | 22 | } |