| 1 |
<?php |
| 2 |
namespace Hurrytimer; |
| 3 |
|
| 4 |
/** |
| 5 |
* Fired during plugin activation |
| 6 |
* |
| 7 |
* @link http://nabillemsieh.com |
| 8 |
* @since 1.0.0 |
| 9 |
* |
| 10 |
* @package Hurrytimer |
| 11 |
* @subpackage Hurrytimer/includes |
| 12 |
*/ |
| 13 |
|
| 14 |
/** |
| 15 |
* Fired during plugin activation. |
| 16 |
* |
| 17 |
* This class defines all code necessary to run during the plugin's activation. |
| 18 |
* |
| 19 |
* @since 1.0.0 |
| 20 |
* @package Hurrytimer |
| 21 |
* @subpackage Hurrytimer/includes |
| 22 |
* @author Nabil Lemsieh <contact@nabillemsieh.com> |
| 23 |
*/ |
| 24 |
class Activator |
| 25 |
{ |
| 26 |
|
| 27 |
/** |
| 28 |
* Short Description. (use period) |
| 29 |
* |
| 30 |
* Long Description. |
| 31 |
* |
| 32 |
* @since 1.0.0 |
| 33 |
*/ |
| 34 |
public static function activate() |
| 35 |
{ |
| 36 |
global $wpdb; |
| 37 |
|
| 38 |
$table = "{$wpdb->prefix}hurrytimer_evergreen"; |
| 39 |
$charset_collate = $wpdb->get_charset_collate(); |
| 40 |
|
| 41 |
$sql = "CREATE TABLE {$table} ( |
| 42 |
id bigint(20) NOT NULL AUTO_INCREMENT, |
| 43 |
countdown_id bigint(20) unsigned NOT NULL, |
| 44 |
client_ip_address varchar(50) NOT NULL, |
| 45 |
expired tinyint(1) unsigned DEFAULT NULL, |
| 46 |
client_expires_at bigint(20) unsigned NOT NULL, |
| 47 |
destroy_at timestamp NULL DEFAULT NULL, |
| 48 |
PRIMARY KEY (id) |
| 49 |
) {$charset_collate}"; |
| 50 |
|
| 51 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php'; |
| 52 |
|
| 53 |
dbDelta($sql); |
| 54 |
|
| 55 |
add_option('hurrytimer_db_version', HURRYT_DB_VERSION); |
| 56 |
add_option(HURRYT_OPTION_VERSION_KEY, HURRYT_VERSION); |
| 57 |
|
| 58 |
} |
| 59 |
|
| 60 |
} |
| 61 |
|