function update_variable_get

Gets the value of a variable from the database during 7.x-8.x upgrades.

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

Parameters

string $name: The name of the variable.

mixed $default: The default value of the variable.

Return value

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

See also

update_variable_set()

update_variable_del()

13 calls to update_variable_get()
LanguageUpgradePathTest::testLanguageUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/LanguageUpgradePathTest.php
Tests a successful upgrade.
locale_update_8001 in drupal/core/modules/locale/locale.install
Language type 'language' renamed to 'language_interface'.
locale_update_8003 in drupal/core/modules/locale/locale.install
Converts language domains to new format.
locale_update_8004 in drupal/core/modules/locale/locale.install
Rename language providers to language negotiation methods.
locale_update_8007 in drupal/core/modules/locale/locale.install
Convert language_negotiation_* variables to use the new callbacks.

... See full list

File

drupal/core/includes/update.inc, line 1140
Drupal 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;
}