fix: dbDelta separate tables, add SEOHead for page titles
1. License table creation: - dbDelta requires separate calls per CREATE TABLE - Split into sql_licenses and sql_activations - Added 'PRIMARY KEY (id)' with two spaces (dbDelta requirement) 2. Page titles: - Added SEOHead to Cart page (title: Shopping Cart) - Added SEOHead to Checkout page (title: Checkout) - Shop already had SEOHead 3. usePageTitle hook created (alternative to SEOHead for non-Helmet usage)
This commit is contained in:
@@ -42,7 +42,10 @@ class LicenseManager {
|
||||
$licenses_table = $wpdb->prefix . self::$table_name;
|
||||
$activations_table = $wpdb->prefix . self::$activations_table;
|
||||
|
||||
$sql = "CREATE TABLE IF NOT EXISTS $licenses_table (
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
|
||||
// Create licenses table - dbDelta requires each CREATE TABLE to be called separately
|
||||
$sql_licenses = "CREATE TABLE $licenses_table (
|
||||
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
license_key varchar(255) NOT NULL,
|
||||
product_id bigint(20) UNSIGNED NOT NULL,
|
||||
@@ -55,15 +58,18 @@ class LicenseManager {
|
||||
expires_at datetime DEFAULT NULL,
|
||||
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id),
|
||||
PRIMARY KEY (id),
|
||||
UNIQUE KEY license_key (license_key),
|
||||
KEY product_id (product_id),
|
||||
KEY order_id (order_id),
|
||||
KEY user_id (user_id),
|
||||
KEY status (status)
|
||||
) $charset_collate;
|
||||
) $charset_collate;";
|
||||
|
||||
CREATE TABLE IF NOT EXISTS $activations_table (
|
||||
dbDelta($sql_licenses);
|
||||
|
||||
// Create activations table
|
||||
$sql_activations = "CREATE TABLE $activations_table (
|
||||
id bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
license_id bigint(20) UNSIGNED NOT NULL,
|
||||
domain varchar(255) DEFAULT NULL,
|
||||
@@ -73,13 +79,12 @@ class LicenseManager {
|
||||
status varchar(20) NOT NULL DEFAULT 'active',
|
||||
activated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
deactivated_at datetime DEFAULT NULL,
|
||||
PRIMARY KEY (id),
|
||||
PRIMARY KEY (id),
|
||||
KEY license_id (license_id),
|
||||
KEY status (status)
|
||||
) $charset_collate;";
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
||||
dbDelta($sql);
|
||||
dbDelta($sql_activations);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user