You are here

function brightcove_requirements in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 8.2 brightcove.install \brightcove_requirements()
  2. 8 brightcove.install \brightcove_requirements()
  3. 6.2 brightcove.install \brightcove_requirements()
  4. 6 brightcove.install \brightcove_requirements()
  5. 7.2 brightcove.install \brightcove_requirements()
  6. 7.3 brightcove.install \brightcove_requirements()
  7. 7.4 brightcove.install \brightcove_requirements()
  8. 7.5 brightcove.install \brightcove_requirements()
  9. 7.6 brightcove.install \brightcove_requirements()
  10. 3.x brightcove.install \brightcove_requirements()

Implements hook_requirements().

File

./brightcove.install, line 218
Installation file for Brightcove module.

Code

function brightcove_requirements($phase) {
  $requirements = [];
  $t = get_t();
  if ($phase !== 'install') {
    $api_wrapper_installed = ($api_wrapper_library = libraries_detect('PHP-API-Wrapper')) && !empty($api_wrapper_library['installed']);
    $requirements['brightcove'] = [
      'title' => $t('Brightcove API Wrapper'),
      'value' => isset($api_wrapper_library['version']) ? $t('Installed') : $t('Not installed'),
      'severity' => $api_wrapper_installed ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      'description' => $api_wrapper_installed ? $t('The Brightcove PHP Wrapper is installed.') : $t('The Brightcove PHP Wrapper is missing.'),
    ];
  }
  if (!function_exists('curl_init')) {
    $requirements['curl']['title'] = $t('cURL');
    $requirements['curl']['description'] = $t('Brightcove MAPI SDK requires a cURL library. You should install it on your server.');
    $requirements['curl']['severity'] = REQUIREMENT_ERROR;
    $requirements['curl']['value'] = $t('Missing');
  }
  if ($phase === 'runtime') {
    $client_found = FALSE;
    $client_id = variable_get('brightcove_client_default');
    if ($client_id) {
      $client_found = (bool) brightcove_client_load($client_id);
    }
    $requirements['brightcove_default_client'] = [
      'title' => $t('Default brightcove client'),
      'severity' => $client_found ? REQUIREMENT_OK : REQUIREMENT_ERROR,
      'value' => $client_found ? $t('Selected') : l($t('Not selected'), 'admin/config/media/brightcove/client'),
    ];
  }
  return $requirements;
}