Add SDK persistence and configurable edge location
All checks were successful
Create Release / build (push) Successful in 4s
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user