variable_initialize

Versions
7
variable_initialize($conf = array())

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.

▾ 1 function calls variable_initialize()

_drupal_bootstrap_variables in includes/bootstrap.inc
Bootstrap variables: Load system variables and all enabled bootstrap modules.

Code

includes/bootstrap.inc, line 701

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

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

  return $variables;
}
?>

Name changed from Drupal 6

jim0203 - Sat, 2009-11-07 14:53

variable_initialize() was called variable_init() in earlier versions of Drupal.

Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.