This repository was archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathslm_installer.php
More file actions
58 lines (52 loc) · 1.97 KB
/
slm_installer.php
File metadata and controls
58 lines (52 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
//***** Installer *****
global $wpdb;
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
//***Installer variables***
$lic_key_table = SLM_TBL_LICENSE_KEYS;
$lic_domain_table = SLM_TBL_LIC_DOMAIN;
$charset_collate = '';
if (!empty($wpdb->charset)){
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
}else{
$charset_collate = "DEFAULT CHARSET=utf8";
}
if (!empty($wpdb->collate)){
$charset_collate .= " COLLATE $wpdb->collate";
}
$lk_tbl_sql = "CREATE TABLE " . $lic_key_table . " (
id int(12) NOT NULL auto_increment,
license_key varchar(255) NOT NULL,
max_allowed_domains int(12) NOT NULL,
lic_status ENUM('pending', 'active', 'blocked', 'expired') NOT NULL DEFAULT 'pending',
first_name varchar(32) NOT NULL default '',
last_name varchar(32) NOT NULL default '',
email varchar(64) NOT NULL,
company_name varchar(100) NOT NULL default '',
txn_id varchar(64) NOT NULL default '',
manual_reset_count varchar(128) NOT NULL default '',
date_created date NOT NULL DEFAULT '0000-00-00',
date_renewed date NOT NULL DEFAULT '0000-00-00',
date_expiry date NOT NULL DEFAULT '0000-00-00',
PRIMARY KEY (id)
)" . $charset_collate . ";";
dbDelta($lk_tbl_sql);
$ld_tbl_sql = "CREATE TABLE " .$lic_domain_table. " (
id INT NOT NULL AUTO_INCREMENT ,
lic_key_id INT NOT NULL ,
lic_key varchar(255) NOT NULL ,
registered_domain text NOT NULL ,
item_reference varchar(255) NOT NULL,
PRIMARY KEY ( id )
)" . $charset_collate . ";";
dbDelta($ld_tbl_sql);
update_option("wp_lic_mgr_db_version", WP_LICENSE_MANAGER_DB_VERSION);
// Add default options
$options = array(
'lic_creation_secret' => uniqid('', true),
'lic_prefix' => '',
'default_max_domains' => '1',
'lic_verification_secret' => uniqid('', true),
'enable_debug' => '',
);
add_option('slm_plugin_options', $options);