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.

▾ 36 functions call variable_set()

block_example_block in developer/examples/block_example.module
Implementation of hook_block().
cache_clear_all in includes/bootstrap.inc
Expire data from the cache.
cache_get in includes/bootstrap.inc
Return data from the persistent cache.
drupal_get_private_key in includes/common.inc
Ensure the private key variable used to generate tokens is set.
file_directory_temp in includes/file.inc
Determine the default temporary directory.
filter_admin_overview_submit in modules/filter.module
forum_block in modules/forum.module
Implementation of hook_block().
forum_form_submit in modules/forum.module
Process forum form and container form submissions.
forum_taxonomy in modules/forum.module
Implementation of hook_taxonomy().
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.
multipage_form_example_custom_submit in developer/examples/multipage_form_example.module
node_update_index in modules/node.module
Implementation of hook_update_index().
node_update_shutdown in modules/node.module
shutdown function to make sure we always mark the last node processed.
profile_block in modules/profile.module
Implementation of hook_block().
statistics_block in modules/statistics.module
Implementation of hook_block().
statistics_cron in modules/statistics.module
Implementation of hook_cron().
system_settings_form_submit in modules/system.module
Execute the system_settings_form.
system_themes_submit in modules/system.module
system_theme_settings_submit in modules/system.module
system_update_119 in database/updates.inc
system_update_126 in database/updates.inc
system_update_145 in database/updates.inc
system_update_151 in database/updates.inc
system_update_160 in database/updates.inc
system_update_165 in database/updates.inc
system_update_179 in database/updates.inc
Update base paths for relative URLs in custom blocks, profiles and various variables.
throttle_exit in modules/throttle.module
Implementation of hook_exit().
update_fix_access_table in ./update.php
update_fix_schema_version in ./update.php
If the schema version for Drupal core is stored in the variables table (4.6.x and earlier) move it to the schema_version column of the system table.
update_fix_sessions in ./update.php
System update 130 changes the sessions table, which breaks the update script's ability to use session variables. This changes the table appropriately.
update_fix_watchdog in ./update.php
System update 142 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.
update_fix_watchdog_115 in ./update.php
System update 115 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.
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 286

<?php
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');

  $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.