From 9f4acf503d7ff0f6ad32f9e9ac4922039ffa34f4 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 17 Dec 2024 14:13:37 +1000 Subject: [PATCH 1/3] Helpscout client: Store the last API request in an accessible field. --- mu-plugins/utilities/class-helpscout.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mu-plugins/utilities/class-helpscout.php b/mu-plugins/utilities/class-helpscout.php index 244f77b25..1c81a26ff 100644 --- a/mu-plugins/utilities/class-helpscout.php +++ b/mu-plugins/utilities/class-helpscout.php @@ -22,6 +22,8 @@ class HelpScout { protected $app_secret = ''; protected $webhook_secret = ''; + public $last_api_request = false; + /** * Fetch an instance of the HelpScout API. */ @@ -178,7 +180,7 @@ public function api( $url, $args = null, $method = 'GET' ) { $body = wp_json_encode( $args ); } - $request = wp_remote_request( + $this->last_api_request = wp_remote_request( $url, array( 'method' => $method, @@ -188,7 +190,7 @@ public function api( $url, $args = null, $method = 'GET' ) { ) ); - return json_decode( wp_remote_retrieve_body( $request ) ); + return json_decode( wp_remote_retrieve_body( $this->last_api_request ) ); } /** From 7a234ee147517282118335c31380784a7c10387e Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 17 Dec 2024 14:14:10 +1000 Subject: [PATCH 2/3] Helpscout client: Remove Foundation support, no longer exists. --- mu-plugins/utilities/class-helpscout.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/mu-plugins/utilities/class-helpscout.php b/mu-plugins/utilities/class-helpscout.php index 1c81a26ff..ec5f88e50 100644 --- a/mu-plugins/utilities/class-helpscout.php +++ b/mu-plugins/utilities/class-helpscout.php @@ -44,11 +44,6 @@ protected function __construct( $app_id, $secret = false, $webhook_secret = fals $app_id = HELPSCOUT_APP_ID; $secret = HELPSCOUT_APP_SECRET; $webhook_secret = HELPSCOUT_WEBHOOK_SECRET_KEY; - } elseif ( 'foundation' === $app_id && defined( 'HELPSCOUT_FOUNDATION_APP_ID' ) ) { - $name = 'foundation'; - $app_id = HELPSCOUT_FOUNDATION_APP_ID; - $secret = HELPSCOUT_FOUNDATION_APP_SECRET; - $webhook_secret = HELPSCOUT_FOUNDATION_WEBHOOK_SECRET_KEY; } $this->name = $name; From 2ac8e27cc732d41177bc61f6aa16416a085573a5 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Tue, 17 Dec 2024 14:14:35 +1000 Subject: [PATCH 3/3] Bump the timeout to 30s, as some endpoints are slow. --- mu-plugins/utilities/class-helpscout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mu-plugins/utilities/class-helpscout.php b/mu-plugins/utilities/class-helpscout.php index ec5f88e50..502cfb4c6 100644 --- a/mu-plugins/utilities/class-helpscout.php +++ b/mu-plugins/utilities/class-helpscout.php @@ -15,7 +15,7 @@ class HelpScout { * * @var int */ - public $timeout = 15; + public $timeout = 30; public $name = ''; protected $app_id = '';