You are here

function background_process_determine_and_save_default_service_host in Background Process 7

Same name and namespace in other branches
  1. 8 background_process.module \background_process_determine_and_save_default_service_host()
  2. 6 background_process.module \background_process_determine_and_save_default_service_host()

Determines the default service host and stores it in the variable storage.

2 calls to background_process_determine_and_save_default_service_host()
background_process_init in ./background_process.module
Implements hook_init().
background_process_settings_form_determine_submit in ./background_process.admin.inc
Submit handler for determining default service host

File

./background_process.module, line 1452

Code

function background_process_determine_and_save_default_service_host() {
  $host = background_process_determine_default_service_host();
  if ($host) {
    global $base_url;
    drupal_set_message(t('Default service host determined at %base_url', array(
      '%base_url' => _background_process_secure_url($host['base_url']),
    )));
    if ($host['base_url'] === $base_url) {
      variable_del('background_process_derived_default_host');
    }
    else {
      variable_set('background_process_derived_default_host', array(
        'default' => $host,
      ));
      drupal_set_message(t('Default service host differs from base url (%base_url). If migrating database to other sites or environments, you will need to either run "Determine default service host" again, or configure the default service host manually through settings.php', array(
        '%base_url' => $base_url,
      )), 'warning');
    }
    return TRUE;
  }
  else {
    drupal_set_message(t('Could not determine default service host. Please configure background process in your settings.php'), 'error');
    return FALSE;
  }
}