function salesforce_fetch_new_tls in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 salesforce.install \salesforce_fetch_new_tls()
- 5.0.x salesforce.install \salesforce_fetch_new_tls()
Check TLS status.
1 call to salesforce_fetch_new_tls()
- salesforce_requirements in ./
salesforce.install - Implements hook_requirements().
File
- ./
salesforce.install, line 109 - Salesforce install file.
Code
function salesforce_fetch_new_tls() {
$response = FALSE;
try {
// Ping the howsmyssl web service to check TLS version support for this
// client.
\Drupal::state()
->set('salesforce.last_requirements_check', time());
$raw_response = \Drupal::service('http_client')
->get('https://www.howsmyssl.com/a/check', [
'json' => TRUE,
'timeout' => 5,
]);
$body = $raw_response
->getBody();
if (!empty($body)) {
$body = $body
->getContents();
if (!empty($body)) {
$response = Json::decode($body);
}
}
} catch (Exception $e) {
// Noop.
}
\Drupal::state()
->set('salesforce.tls_status', $response);
return $response;
}