variable_set

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

Set a persistent variable.

See also

variable_del(), variable_get()

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.

▾ 112 functions call variable_set()

aggregator_update_7001 in modules/aggregator/aggregator.install
Add aggregator teaser length to settings from old global default teaser length
authorize_filetransfer_form_submit in includes/authorize.inc
Submit callback when a file transfer is being authorized.
block_example_block_save in developer/examples/block_example.module
Implementation of hook_block_save().
book_block_save in modules/book/book.module
Implement hook_block_save().
book_node_type_update in modules/book/book.module
Implement hook_node_type_update().
comment_block_save in modules/comment/comment.module
Implement hook_block_save().
comment_update_7004 in modules/comment/comment.install
Rename comment display setting variables.
comment_update_7009 in modules/comment/comment.install
Update preview setting variable to use new constants
comment_update_index in modules/comment/comment.module
Implement hook_update_index().
contact_update_7000 in modules/contact/contact.install
Rename the threshold limit variable.
default_install in profiles/default/default.install
Implement hook_install().
drupal_clear_js_cache in includes/common.inc
Delete all cached JS files.
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.
drupal_http_request in includes/common.inc
Perform an HTTP request.
drupal_path_alias_whitelist_rebuild in includes/path.inc
Rebuild the path alias white list.
example_form_submit in developer/example.profile
Form API submit for the example form.
example_profile_tasks in developer/example.profile
Perform any final installation tasks for this profile.
field_test_create_bundle in modules/simpletest/tests/field_test.module
Create a new bundle for test_entity objects.
field_test_delete_bundle in modules/simpletest/tests/field_test.module
Delete a bundle for test_entity objects.
field_test_rename_bundle in modules/simpletest/tests/field_test.module
Rename a bundle for test_entity objects.
field_ui_field_attach_create_bundle in modules/field_ui/field_ui.module
Implement hook_field_attach_create_bundle().
field_ui_field_attach_rename_bundle in modules/field_ui/field_ui.module
Implement hook_field_attach_rename_bundle().
field_ui_field_overview_form_submit in modules/field_ui/field_ui.admin.inc
Submit handler for the field overview form.
file_test_reset in modules/simpletest/tests/file_test.module
Reset/initialize the history of calls to the file_* hooks.
file_test_set_return in modules/simpletest/tests/file_test.module
Assign a return value for a given operation.
filter_update_7005 in modules/filter/filter.install
Integrate text formats with the user permissions system.
forum_block_save in modules/forum/forum.module
Implement hook_block_save().
forum_enable in modules/forum/forum.install
forum_form_submit in modules/forum/forum.admin.inc
Process forum form and container form submissions.
forum_install in modules/forum/forum.install
Implement hook_install().
forum_taxonomy_term_delete in modules/forum/forum.module
Implement hook_taxonomy().
hook_block_save in modules/block/block.api.php
Save the configuration options.
hook_cron in modules/system/system.api.php
Perform periodic actions.
hook_image_style_delete in modules/image/image.api.php
Respond to image style deletion.
hook_image_style_save in modules/image/image.api.php
Respond to image style updating.
hook_menu_delete in modules/menu/menu.api.php
Informs modules that a custom menu was deleted.
hook_menu_insert in modules/menu/menu.api.php
Informs modules that a custom menu was created.
hook_menu_update in modules/menu/menu.api.php
Informs modules that a custom menu was updated.
hook_modules_installed in modules/system/system.api.php
Perform necessary actions after modules are installed.
hook_node_type_update in modules/node/node.api.php
Act on node type changes.
hook_taxonomy_vocabulary_insert in modules/taxonomy/taxonomy.api.php
Act on taxonomy vocabularies when inserted.
hook_taxonomy_vocabulary_update in modules/taxonomy/taxonomy.api.php
Act on taxonomy vocabularies when updated.
hook_update_index in modules/search/search.api.php
Update Drupal's full-text index for this module.
image_test_reset in modules/simpletest/tests/image_test.module
Reset/initialize the history of calls to the toolkit functions.
language_negotiation_set in includes/language.inc
Save a list of language providers.
language_types_disable in includes/language.inc
Disable the given language types.
locale_add_language in includes/locale.inc
API function to add a language.
locale_js_alter in modules/locale/locale.module
Implement hook_js_alter().
locale_languages_configure_form_submit in includes/locale.inc
Submit handler for language negotiation settings.
locale_languages_edit_form_submit in includes/locale.inc
Process the language editing form submission.
locale_languages_overview_form_submit in includes/locale.inc
Process language overview form submissions, updating existing languages.
locale_update_7001 in modules/locale/locale.install
Upgrade language negotiation settings.
menu_rebuild in includes/menu.inc
(Re)populate the database tables used by various menu functions.
node_access_needs_rebuild in modules/node/node.module
Flag / unflag the node access grants for rebuilding, or read the current value of the flag.
node_type_form_submit in modules/node/content_types.inc
Implement hook_form_submit().
node_update_7004 in modules/node/node.install
Extend the existing default preview and teaser settings to all node types.
openid_test_install in modules/openid/tests/openid_test.install
Implement hook_install().
profile_block_save in modules/profile/profile.module
Implement hook_block_save().
search_admin_settings_submit in modules/search/search.admin.inc
Submit callback.
statistics_block_save in modules/statistics/statistics.module
Implement hook_block_save().
statistics_cron in modules/statistics/statistics.module
Implement hook_cron().
statistics_update_index in modules/statistics/statistics.module
Implement hook_update_index().
system_add_date_format_type_form_submit in modules/system/system.admin.inc
Process system_add_date_format_type form submissions.
system_check_http_request in modules/system/system.module
Checks whether the server is capable of issuing HTTP requests.
system_image_toolkit_settings in modules/system/system.admin.inc
Form builder; Configure site image toolkit usage.
system_install in modules/system/system.install
Implement hook_install().
system_run_cron_image in modules/system/system.module
Menu callback; executes cron via an image callback.
system_settings_form_submit in modules/system/system.module
Execute the system_settings_form.
system_test_batch_theme_callback in modules/simpletest/tests/system_test.module
Batch callback function for testing the theme used by a batch.
system_test_system_info_alter in modules/simpletest/tests/system_test.module
Implement hook_system_info_alter().
system_themes_form_submit in modules/system/system.admin.inc
Process system_themes_form form submissions.
system_theme_settings_submit in modules/system/system.admin.inc
Process system_theme_settings form submissions.
system_update_7001 in modules/system/system.install
Generate a cron key and save it in the variables table.
system_update_7004 in modules/system/system.install
Remove hardcoded numeric deltas from all blocks in core.
system_update_7013 in modules/system/system.install
Convert default time zone offset to default time zone name.
system_update_7017 in modules/system/system.install
Change the theme setting 'toggle_node_info' into a per content type variable.
system_update_7021 in modules/system/system.install
Add new blocks to new regions, migrate custom variables to blocks.
system_update_7033 in modules/system/system.install
Move CACHE_AGGRESSIVE to CACHE_NORMAL.
system_update_7034 in modules/system/system.install
Migrate the file_downloads setting and create the new {file} table.
tracker_cron in modules/tracker/tracker.module
Implement hook_cron().
tracker_enable in modules/tracker/tracker.install
Implement hook_enable().
tracker_update_7000 in modules/tracker/tracker.install
Create new tracker_node and tracker_user tables.
trigger_example_ping in developer/examples/trigger_example.module
Function to generate ping events and invoke hook_trigger_example().
trigger_example_pong in developer/examples/trigger_example.module
Function to generate pong events and invoke hook_trigger_example().
trigger_test_generic_action in modules/trigger/tests/trigger_test.module
Action fired during the "taxonomy", "comment", and "user" trigger tests.
trigger_test_generic_any_action in modules/trigger/tests/trigger_test.module
Action fired during the additional trigger tests.
trigger_test_system_cron_action in modules/trigger/tests/trigger_test.module
Action fired during the "cron run" trigger test.
trigger_test_system_cron_conf_action in modules/trigger/tests/trigger_test.module
Implement a configurable Drupal action.
update_authorize_install_batch_finished in modules/update/update.authorize.inc
Batch callback for when the authorized install batch is finished.
update_authorize_update_batch_finished in modules/update/update.authorize.inc
Batch callback for when the authorized update batch is finished.
update_batch in includes/update.inc
Start the database update batch process.
update_finished in includes/update.inc
Finish the update process and store results for eventual display.
update_fix_d7_requirements in includes/update.inc
Perform Drupal 6.x to 7.x updates that are required for update.php to function properly.
update_manager_confirm_update_form_submit in modules/update/update.manager.inc
Submit handler for the form to confirm that an update should continue.
update_settings_submit in modules/update/update.settings.inc
Submit handler for the settings tab.
user_block_save in modules/user/user.module
Implement hook_block_save().
user_image_style_save in modules/user/user.module
Implement hook_image_style_save().
user_update_7002 in modules/user/user.install
Convert user time zones from time zone offsets to time zone names.
user_update_7003 in modules/user/user.install
Update user settings for cancelling user accounts.
_book_install_type_create in modules/book/book.install
_drupal_flush_css_js in includes/common.inc
Helper function to change query-strings on css/js files.
_field_sql_storage_etid in modules/field/modules/field_sql_storage/field_sql_storage.module
Retrieve or assign an entity type id for an object type.
_field_test_storage_data in modules/simpletest/tests/field_test.module
Helper function: store or retrieve data from the 'storage backend'.
_file_test_log_call in modules/simpletest/tests/file_test.module
Store the values passed to a hook invocation.
_image_test_log_call in modules/simpletest/tests/image_test.module
Store the values passed to a toolkit call.
_locale_invalidate_js in includes/locale.inc
Force the JavaScript translation file(s) to be refreshed.
_locale_rebuild_js in includes/locale.inc
(Re-)Creates the JavaScript translation file for a language.
_menu_router_save in includes/menu.inc
Helper function to save data from menu_router_build() to the router table.
_menu_set_expanded_menus in includes/menu.inc
Helper function to update a list of menus with expanded items
_node_index_node in modules/node/node.module
Index a single node.
_update_process_fetch_task in modules/update/update.fetch.inc
Process a task to fetch available update data for a single project.

Code

includes/bootstrap.inc, line 747

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

  db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute();

  cache_clear_all('variables', 'cache');

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