Add SDK persistence and configurable edge location
All checks were successful
Create Release / build (push) Successful in 4s

- Add external SDK installation (wp-content/twilio-sdk/) that survives
  WordPress plugin updates
- Add install-twilio-sdk-external.sh script for external SDK setup
- Update SDK loading to check external location first, internal fallback
- Add post-update detection hook to warn if SDK was deleted
- Add configurable Twilio Edge Location setting (default: roaming)
- Fix US calls failing due to hardcoded Sydney edge location

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-23 18:03:38 -08:00
parent f0806d7e67
commit 3e4dff5c4e
7 changed files with 392 additions and 26 deletions

View File

@@ -9,9 +9,25 @@ class TWP_Webhooks {
*/
public function __construct() {
// Load Twilio SDK if not already loaded
// Check external location first (survives plugin updates), then internal
if (!class_exists('\Twilio\Rest\Client')) {
$autoloader_path = plugin_dir_path(dirname(__FILE__)) . 'vendor/autoload.php';
if (file_exists($autoloader_path)) {
$autoloader_path = null;
// Priority 1: External SDK location
$external_autoloader = dirname(dirname(plugin_dir_path(dirname(__FILE__)))) . '/twilio-sdk/autoload.php';
if (file_exists($external_autoloader)) {
$autoloader_path = $external_autoloader;
}
// Priority 2: Internal vendor directory
if (!$autoloader_path) {
$internal_autoloader = plugin_dir_path(dirname(__FILE__)) . 'vendor/autoload.php';
if (file_exists($internal_autoloader)) {
$autoloader_path = $internal_autoloader;
}
}
if ($autoloader_path) {
require_once $autoloader_path;
}
}