function acquia_spi_get_variables_data in Acquia Connector 7.3
Same name and namespace in other branches
- 6.2 acquia_spi/acquia_spi.module \acquia_spi_get_variables_data()
- 7.2 acquia_spi/acquia_spi.module \acquia_spi_get_variables_data()
Get all system variables.
Return value
string Json.
2 calls to acquia_spi_get_variables_data()
- AcquiaSPITestCase::testAcquiaSpiSetVariables in acquia_spi/
tests/ acquia_spi.test - Needs comment.
- acquia_spi_get in acquia_spi/
acquia_spi.module - Gather site profile information about this site.
File
- acquia_spi/
acquia_spi.module, line 1307 - 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_send_watchdog',
'acquia_spi_use_cron',
'cache_backends',
'cache_default_class',
'cache_inc',
'cron_safe_threshold',
'googleanalytics_cache',
'error_level',
'preprocess_js',
'page_cache_maximum_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',
'user_admin_role',
'user_email_verification',
'user_cancel_method',
'filter_fallback_format',
'dblog_row_limit',
'date_default_timezone',
'file_default_scheme',
'install_profile',
'maintenance_mode',
'update_last_check',
'site_default_country',
'acquia_spi_saved_variables',
'acquia_spi_set_variables_automatic',
'acquia_spi_ignored_set_variables',
'acquia_spi_set_variables_override',
);
$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_type_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();
}
// Drush overrides cron_safe_threshold so extract DB value if sending via
// drush.
if (drupal_is_cli()) {
$cron_safe_threshold = acquia_spi_get_db_variable('cron_safe_threshold');
$data['cron_safe_threshold'] = !is_null($cron_safe_threshold) ? $cron_safe_threshold : DRUPAL_CRON_DEFAULT_THRESHOLD;
}
// 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 drupal_json_encode($data);
}