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().

Parameters

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

File

core/includes/update.inc, line 469
Backdrop database update API.

Code

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;
}