function drupal_get_installed_schema_version

8.x drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)

Returns the currently installed schema version for a module.


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.

Related topics

11 calls to drupal_get_installed_schema_version()
drupal_load_updates in drupal/core/includes/
Loads .install files for installed modules to initialize the update system.
drupal_set_installed_schema_version in drupal/core/includes/
Updates the installed version information for a module.
ModuleHandler::enable in drupal/core/lib/Drupal/Core/Extension/ModuleHandler.php
Enables or installs a given list of modules.
ModuleHandler::uninstall in drupal/core/lib/Drupal/Core/Extension/ModuleHandler.php
Uninstalls a given list of disabled modules.
system_modules_submit in drupal/core/modules/system/
Submit callback; handles modules form submission.

... See full list


drupal/core/includes/, line 168
Schema API handling functions.


function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
  static $versions = array();

  if ($reset) {
    $versions = array();

  if (!$versions) {
    if (!$versions = Drupal::keyValue('system.schema')->getAll()) {
      $versions = array();

  if ($array) {
    return $versions;
  else {
    return isset($versions[$module]) ? $versions[$module] : SCHEMA_UNINSTALLED;