Definition

variable_init($conf = array())
drupal/includes/bootstrap.inc, line 576

Description

Load the persistent variable table.

The variable table is composed of values that have been saved in the table with variable_set() as well as those explicitly specified in the configuration file.

Code

function variable_init($conf = array()) {
  // NOTE: caching the variables improves performance by 20% when serving cached pages.
  if ($cached = cache_get('variables', 'cache')) {
    $variables = $cached->data;
  }
  else {
    $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed());
    cache_set('variables', $variables);
  }

  foreach ($conf as $name => $value) {
    $variables[$name] = $value;
  }

  return $variables;
}