You are here

function bbb_test_connection in BigBlueButton 6

Same name and namespace in other branches
  1. 7 includes/pages.bbb.inc \bbb_test_connection()

Test conection to Big Blue Button

2 calls to bbb_test_connection()
bbb_settings in includes/pages.bbb.inc
Administrative settings; Menu callback
bbb_update_6102 in ./bbb.install
Implement hook_update_N().

File

includes/pages.bbb.inc, line 107
Big Blue Button - Enables universities and colleges to deliver a high-quality learning experience.

Code

function bbb_test_connection($request, $security_salt) {
  if (!function_exists('bbb_api_debug')) {
    include_once 'api.bbb.inc';
  }
  bbb_api_debug($request);
  $xml = @simplexml_load_file($request);
  $response = bbb_api_parse_response($xml);
  bbb_api_debug($response);

  // Check for API version >= 0.7
  if ($response->returncode == 'SUCCESS' && is_numeric($response->version)) {
    $version = $response->version;
    variable_set('bbb_api_version', $version);
  }
  else {
    if ($response->returncode == 'FAILED' && $response->messageKey == 'noActionSpecified' && $response->message == 'You did not specify an API action.') {

      // Assumeing API version 0.64
      $version = 0.64;
      variable_set('bbb_api_version', $version);
    }
    else {
      drupal_set_message(t('The connection could not be established correctly. The server response was: %message.', array(
        '%message' => $response->message ? $response->message : t('No response'),
      )), 'error');
      watchdog('big blue button', '%message', array(
        '%message' => $response->message,
      ), WATCHDOG_ERROR);
      return FALSE;
    }
  }
  drupal_set_message(t('The connection has been established succesfully, the API version has been determined as v@version. Please save your configuration now.', array(
    '@version' => $version,
  )));
  return $version;
}