function update_variable_set

Sets a persistent variable during the 7.x-8.x upgrade path.

Use this during the 7.x-8.x upgrade path instead of variable_set().

Parameters

string $name: The name of the variable to set.

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

See also

update_variable_get()

update_variable_del()

Related topics

11 calls to update_variable_set()

File

drupal/core/includes/update.inc, line 1321
Drupal database update API.

Code

function update_variable_set($name, $value) {
  db_merge('variable')
    ->key(array(
    'name' => $name,
  ))
    ->fields(array(
    'value' => serialize($value),
  ))
    ->execute();
}