You are here

function drupal_get_installed_schema_version in Drupal 9

Same name and namespace in other branches
  1. 8 core/includes/schema.inc \drupal_get_installed_schema_version()
  2. 4 includes/install.inc \drupal_get_installed_schema_version()
  3. 5 includes/install.inc \drupal_get_installed_schema_version()
  4. 6 includes/install.inc \drupal_get_installed_schema_version()
  5. 7 includes/install.inc \drupal_get_installed_schema_version()

Returns the currently installed schema version for a module.

Parameters

string $module: A module name.

bool $reset: Set to TRUE after installing or uninstalling an extension.

bool $array: Set to TRUE if you want to get information about all modules in the system.

Return value

string|int The currently installed schema version, or SCHEMA_UNINSTALLED if the module is not installed.

Deprecated

in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion() or \Drupal\Core\Update\UpdateHookRegistry::getAllInstalledVersions() instead.

See also

https://www.drupal.org/node/2444417

\Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion()

Related topics

1 call to drupal_get_installed_schema_version()
UpdateDeprecationTest::testDrupalGetInstalledSchemaVersion in core/tests/Drupal/KernelTests/Core/Extension/UpdateDeprecationTest.php
Deprecation testing for drupal installed schema version functions.

File

core/includes/schema.inc, line 70
Schema API handling functions.

Code

function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
  @trigger_error('drupal_get_installed_schema_version() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \\Drupal\\Core\\Update\\UpdateHookRegistry::getInstalledVersion() or \\Drupal\\Core\\Update\\UpdateHookRegistry::getAllInstalledVersions() instead. See https://www.drupal.org/node/2444417', E_USER_DEPRECATED);

  /** @var \Drupal\Core\Update\UpdateHookRegistry $service */
  $service = \Drupal::service('update.update_hook_registry');
  if ($array) {
    return $service
      ->getAllInstalledVersions();
  }
  return $service
    ->getInstalledVersion((string) $module);
}