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:
@@ -41,13 +41,28 @@ class TWP_Twilio_API {
|
||||
* Initialize Twilio SDK client
|
||||
*/
|
||||
private function init_sdk_client() {
|
||||
// Check if autoloader exists
|
||||
$autoloader_path = TWP_PLUGIN_DIR . 'vendor/autoload.php';
|
||||
if (!file_exists($autoloader_path)) {
|
||||
error_log('TWP Plugin: Autoloader not found at: ' . $autoloader_path);
|
||||
throw new Exception('Twilio SDK not found. Please run: ./install-twilio-sdk.sh');
|
||||
// Check for SDK autoloader - external location first (survives plugin updates)
|
||||
$autoloader_path = null;
|
||||
|
||||
// Priority 1: External SDK location (recommended)
|
||||
$external_autoloader = TWP_EXTERNAL_SDK_DIR . 'autoload.php';
|
||||
if (file_exists($external_autoloader)) {
|
||||
$autoloader_path = $external_autoloader;
|
||||
}
|
||||
|
||||
|
||||
// Priority 2: Internal vendor directory (fallback)
|
||||
if (!$autoloader_path) {
|
||||
$internal_autoloader = TWP_PLUGIN_DIR . 'vendor/autoload.php';
|
||||
if (file_exists($internal_autoloader)) {
|
||||
$autoloader_path = $internal_autoloader;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$autoloader_path) {
|
||||
error_log('TWP Plugin: Autoloader not found. Checked: ' . $external_autoloader . ' and ' . TWP_PLUGIN_DIR . 'vendor/autoload.php');
|
||||
throw new Exception('Twilio SDK not found. Please run: ./install-twilio-sdk-external.sh');
|
||||
}
|
||||
|
||||
// Load the autoloader
|
||||
require_once $autoloader_path;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user