1 update.inc update_variable_get($name, $default = NULL)

Gets the value of a variable from the database during update hooks.

Use this during the upgrade path instead of variable_get().


string $name: The name of the variable.

mixed $default: The default value of the variable.

Return value

The value of the variable in the database unserialized, or NULL if not set.:


core/includes/update.inc, line 470
Backdrop site update API.


function update_variable_get($name, $default = NULL) {
  $result = db_query('SELECT value FROM {variable} WHERE name = :name', array(':name' => $name))->fetchField();
  if ($result !== FALSE) {
    return unserialize($result);
  return $default;