variable_set
includes/bootstrap.inc, line 464
- 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.
▾ 49 functions call variable_set()
- block_example_block in developer/examples/block_example.module
- Implementation of hook_block().
- 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.
- drupal_cron_run in includes/common.inc
- Executes a cron run when called
- 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/filter.module
- forum_block in modules/forum/forum.module
- Implementation of hook_block().
- forum_form_submit in modules/forum/forum.module
- Process forum form and container form submissions.
- forum_taxonomy in modules/forum/forum.module
- Implementation of hook_taxonomy().
- hook_block in developer/hooks/core.php
- Declare a block or set of blocks.
- hook_node_type in developer/hooks/node.php
- Act on node type changes.
- 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.
- install_complete in ./install.php
- Page displayed when the installation is complete. Called from install.php.
- multipage_form_example_custom_submit in developer/examples/multipage_form_example.module
- node_type_form_submit in modules/node/content_types.inc
- Implementation of hook_form_submit().
- node_update_index in modules/node/node.module
- Implementation of hook_update_index().
- node_update_shutdown in modules/node/node.module
- shutdown function to make sure we always mark the last node processed.
- profile_block in modules/profile/profile.module
- Implementation of hook_block().
- statistics_block in modules/statistics/statistics.module
- Implementation of hook_block().
- statistics_cron in modules/statistics/statistics.module
- Implementation of hook_cron().
- system_node_type in modules/system/system.module
- Implementation of hook_node_type().
- system_settings_form_submit in modules/system/system.module
- Execute the system_settings_form.
- system_themes_submit in modules/system/system.module
- system_theme_settings_submit in modules/system/system.module
- system_update_1018 in modules/system/system.install
- Change break tag (was removed, see 1020).
- system_update_1019 in modules/system/system.install
- Change variable format for user-defined e-mails.
- system_update_1021 in modules/system/system.install
- Update two more variables that were missing from system_update_1019.
- system_update_1022 in modules/system/system.install
- Add index on users created column.
- system_update_119 in modules/system/system.install
- system_update_126 in modules/system/system.install
- system_update_145 in modules/system/system.install
- system_update_151 in modules/system/system.install
- system_update_160 in modules/system/system.install
- system_update_165 in modules/system/system.install
- system_update_179 in modules/system/system.install
- Update base paths for relative URLs in custom blocks, profiles and various variables.
- throttle_exit in modules/throttle/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/user.module
- Implementation of hook_block().
- _color_render_images in modules/color/color.module
- Render images that match a given palette.
- _forum_get_vid in modules/forum/forum.module
- Returns the vocabulary id for forum navigation.
Code
<?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', 'cache');
$conf[$name] = $value;
}
?> 