variable_set

Versions
4.6 – 7
variable_set($name, $value)

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.

▾ 29 functions call variable_set()

comment_role_settings in modules/comment.module
Menu callback; allows admin to set default scores for different roles.
drupal_cron in modules/drupal.module
Implementation of hook_cron(); handles pings to and from the site.
drupal_get_private_key in includes/common.inc
Ensure the private key variable used to generate tokens is set.
filter_admin_save in modules/filter.module
Save input formats on the overview page.
forum_admin in modules/forum.module
Administration page which allows maintaining forums
forum_block in modules/forum.module
Implementation of hook_block().
hook_block in developer/hooks/core.php
Declare a block or set of blocks.
hook_taxonomy in developer/hooks/core.php
Act on taxonomy changes.
hook_update_index in developer/hooks/core.php
Update Drupal's full-text index for this module.
node_update_index in modules/node.module
Implementation of hook_update_index().
ping_cron in modules/ping.module
Implementation of hook_cron().
statistics_block in modules/statistics.module
Implementation of hook_block().
statistics_cron in modules/statistics.module
Implementation of hook_cron().
statistics_save_statistics in modules/statistics.module
Saves the values entered in the "config statistics" administration form.
system_listing_save in modules/system.module
system_settings_save in modules/system.module
system_test in modules/system.module
Menu callback: dummy clean URL tester.
system_view_general in modules/system.module
throttle_exit in modules/throttle.module
Implementation of hook_exit().
update_104 in database/updates.inc
update_119 in database/updates.inc
update_126 in database/updates.inc
update_33 in database/updates.inc
update_80 in database/updates.inc
update_99 in database/updates.inc
update_data in ./update.php
update_page in ./update.php
user_block in modules/user.module
Implementation of hook_block().
_forum_get_vid in modules/forum.module
Returns the vocabulary id for forum navigation.

Code

includes/bootstrap.inc, line 166

<?php
function variable_set($name, $value) {
  global $conf;

  db_query("DELETE FROM {variable} WHERE name = '%s'", $name);
  db_query("INSERT INTO {variable} (name, value) VALUES ('%s', '%s')", $name, serialize($value));
  cache_clear_all('variables');

  $conf[$name] = $value;
}
?>
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.