| Linux server27.hostingraja.org 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64 Path : /home/udaipurk/www/websites/rvd_tempewmove/wp-content/plugins/wp-mail-log/classes/ |
| Current File : /home/udaipurk/www/websites/rvd_tempewmove/wp-content/plugins/wp-mail-log/classes/db-table.php |
<?php
namespace WML\Classes;
/**
* Database Tables
*
* This class is to manage database table.
*
*/
class DbTable {
private static $wml_db_version = '1.0';
/**
* This function fire on plugins_loaded action in bootstrap file.
*
* @access public
* @since 0.3
* @return void
*/
public static function wml_plugin_activated() {
if ( get_option( 'wml_db_version' ) !== self::$wml_db_version ) {
self::create_db_table();
}
}
/**
* Create Database Table
*
* @return void
* @since 0.3
* @access public
*/
public static function create_db_table() {
global $wpdb;
$table_name = $wpdb->prefix . 'wml_entries';
$wpdb_collate = $wpdb->collate;
$sql = "CREATE TABLE {$table_name} (
`id` int(11) PRIMARY KEY AUTO_INCREMENT NOT NULL,
`to_email` VARCHAR(100) NOT NULL,
`subject` VARCHAR(250) NOT NULL,
`message` TEXT NOT NULL,
`headers` TEXT NOT NULL,
`attachments` TEXT NOT NULL,
`sent_date` VARCHAR(50) NOT NULL,
`captured_gmt` VARCHAR(50) NOT NULL
) collate {$wpdb_collate};";
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta( $sql, true );
if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}wml_entries'" ) !== null ) {
update_option( 'wml_db_version', self::$wml_db_version );
}
}
}