You are here

function acquia_spi_get_variables_data in Acquia Connector 6.2

Same name and namespace in other branches
  1. 7.3 acquia_spi/acquia_spi.module \acquia_spi_get_variables_data()
  2. 7.2 acquia_spi/acquia_spi.module \acquia_spi_get_variables_data()

get all system variables

Parameters

n/a:

Return value

string

1 call to acquia_spi_get_variables_data()
acquia_spi_get in acquia_spi/acquia_spi.module
Gather site profile information about this site.

File

acquia_spi/acquia_spi.module, line 1119
Send site profile information (NSPI) and system data to Acquia Insight.

Code

function acquia_spi_get_variables_data() {
  global $conf;
  $data = array();
  $variables = array(
    'acquia_spi_send_node_user',
    'acquia_spi_admin_priv',
    'acquia_spi_module_diff_data',
    'acquia_spi_send_watchdog',
    'acquia_spi_use_cron',
    'cache_inc',
    'cacherouter',
    'googleanalytics_cache',
    'error_level',
    'preprocess_js',
    'page_cache_max_age',
    'block_cache',
    'preprocess_css',
    'page_compression',
    'cache',
    'cache_lifetime',
    'cron_last',
    'clean_url',
    'redirect_global_clean',
    'theme_zen_settings',
    'site_offline',
    'site_name',
    'user_register',
    'user_signatures',
    'filter_default_format',
    'filter_html_1',
    'filter_html_2',
    'poormanscron_interval',
    'dblog_row_limit',
    'install_profile',
    'user_email_verification',
  );
  $spi_def_vars = variable_get('acquia_spi_def_vars', array());
  $waived_spi_def_vars = variable_get('acquia_spi_def_waived_vars', array());

  // Merge hard coded $variables with vars from SPI definition.
  foreach ($spi_def_vars as $var_name => $var) {
    if (!in_array($var_name, $waived_spi_def_vars) && !in_array($var_name, $variables)) {
      $variables[] = $var_name;
    }
  }

  // Add comment settings for node types.
  $types = node_get_types();
  if (!empty($types)) {
    foreach ($types as $name => $type) {
      $variables[] = 'comment_' . $name;
    }
  }
  foreach ($variables as $name) {
    if (isset($conf[$name])) {
      $data[$name] = $conf[$name];
    }
  }

  // Exception handling.
  if (module_exists('globalredirect') && function_exists('_globalredirect_get_settings')) {

    // Explicitly get Global Redirect settings since it deletes its variable
    // if the settings match the defaults.
    $data['globalredirect_settings'] = _globalredirect_get_settings();
  }

  // Unset waived vars so they won't be sent to NSPI.
  foreach ($data as $var_name => $var) {
    if (in_array($var_name, $waived_spi_def_vars)) {
      unset($data[$var_name]);
    }
  }

  // Collapse to JSON string to simplify transport.
  return _acquia_spi_json($data);
}