progress made

This commit is contained in:
2025-08-11 20:31:48 -07:00
parent 805af2f199
commit 304b5de40b
15 changed files with 4028 additions and 404 deletions

View File

@@ -15,7 +15,8 @@ if (!defined('WPINC')) {
}
// Plugin constants
define('TWP_VERSION', '1.0.0');
define('TWP_VERSION', '1.3.13');
define('TWP_DB_VERSION', '1.1.0'); // Track database version separately
define('TWP_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('TWP_PLUGIN_URL', plugin_dir_url(__FILE__));
define('TWP_PLUGIN_BASENAME', plugin_basename(__FILE__));
@@ -62,9 +63,23 @@ function twp_sdk_missing_notice() {
<?php
}
// Check SDK installation on admin pages
// Check SDK installation and database updates on admin pages
if (is_admin()) {
add_action('admin_init', 'twp_check_sdk_installation');
add_action('admin_init', 'twp_check_database_updates');
}
/**
* Check and perform database updates if needed
*/
function twp_check_database_updates() {
$current_db_version = get_option('twp_db_version', '1.0.0');
if (version_compare($current_db_version, TWP_DB_VERSION, '<')) {
require_once TWP_PLUGIN_DIR . 'includes/class-twp-activator.php';
TWP_Activator::ensure_tables_exist();
update_option('twp_db_version', TWP_DB_VERSION);
}
}
/**