You are here

function variable_set in Drupal 5

Same name and namespace in other branches
  1. 4 includes/bootstrap.inc \variable_set()
  2. 6 includes/bootstrap.inc \variable_set()
  3. 7 includes/bootstrap.inc \variable_set()

Set a persistent variable.

Parameters

$name: The name of the variable to set.

$value: The value to set. This can be any PHP data type; these functions take care of serialization as necessary.

43 calls to variable_set()
cache_clear_all in includes/cache.inc
Expire data from the cache. If called without arguments, expirable entries will be cleared from the cache_page table.
cache_get in includes/cache.inc
Return data from the persistent cache.
color_scheme_form_submit in modules/color/color.module
Submit handler for color change form.
comment_update_1 in modules/comment/comment.install
Changed node_comment_statistics to use node->changed to avoid future timestamps.
default_profile_final in profiles/default/default.profile
Perform any final installation tasks for this profile.

... See full list

File

includes/bootstrap.inc, line 464
Functions that need to be loaded on every Drupal request.

Code

function variable_set($name, $value) {
  global $conf;
  db_lock_table('variable');
  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
  db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
  db_unlock_tables();
  cache_clear_all('variables', 'cache');
  $conf[$name] = $value;
}