Fix fatal "TWP_Activator not found" on voicemail webhook callback
The activator class was only loaded during plugin activation, on admin_init when the DB version differed, and in a few explicit admin handlers. Twilio webhook callbacks (voicemail in particular, but also any non-admin caller of TWP_Activator::force_table_updates() / ::ensure_tables_exist()) hit the public REST endpoint where none of those load paths fire, so the static call fataled. Load class-twp-activator.php in TWP_Core::load_dependencies() so every plugin context — webhook, REST, cron, admin — has the class available. The activator file is a pure class definition with no load-time side effects. This single change covers all 9 runtime call sites (webhook, scheduler, and six admin sites) that previously assumed the class would already be loaded. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,7 +29,12 @@ class TWP_Core {
|
||||
private function load_dependencies() {
|
||||
// Loader class
|
||||
require_once TWP_PLUGIN_DIR . 'includes/class-twp-loader.php';
|
||||
|
||||
|
||||
// Activator (defines TWP_Activator). Loaded here so runtime callers in
|
||||
// webhook/REST/cron contexts can use ::ensure_tables_exist() and
|
||||
// ::force_table_updates() without each site needing its own require_once.
|
||||
require_once TWP_PLUGIN_DIR . 'includes/class-twp-activator.php';
|
||||
|
||||
// API classes
|
||||
require_once TWP_PLUGIN_DIR . 'includes/class-twp-twilio-api.php';
|
||||
require_once TWP_PLUGIN_DIR . 'includes/class-twp-elevenlabs-api.php';
|
||||
|
||||
Reference in New Issue
Block a user