You are here

function salesforce_requirements in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 salesforce.install \salesforce_requirements()
  2. 8.3 salesforce.install \salesforce_requirements()
  3. 7.3 salesforce.install \salesforce_requirements()

Implements hook_requirements().

1 call to salesforce_requirements()
StatusPageTest::testRequirementsHook in tests/src/Functional/StatusPageTest.php
Test implementation of salesforce_requirements().

File

./salesforce.install, line 35
Salesforce install file.

Code

function salesforce_requirements($phase) {
  if ($phase != 'runtime') {
    return [];
  }

  // Check requirements once per 24 hours.
  $last = \Drupal::state()
    ->get('salesforce.last_requirements_check', 0);
  $requirements['salesforce_auth_provider'] = salesforce_get_auth_provider_requirements();

  // Don't bother checking usage if we aren't connected to Salesforce.
  if ($requirements['salesforce_auth_provider']['severity'] == REQUIREMENT_OK) {
    $requirements['salesforce_usage'] = salesforce_get_usage_requirements();
  }
  $requirements['salesforce_tls'] = salesforce_get_tls_requirements();
  if ($last < time() - 60 * 60 * 24 || empty($requirements['salesforce_tls'])) {
    salesforce_fetch_new_tls();
    $requirements['salesforce_tls'] = salesforce_get_tls_requirements();
  }
  return $requirements;
}