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

Related topics

14 calls to drupal_get_installed_schema_version()
drupal_load_updates in drupal/core/includes/install.inc
Loads .install files for installed modules to initialize the update system.
drupal_set_installed_schema_version in drupal/core/includes/schema.inc
Updates the installed version information for a module.
ModuleApiTest::testDependencyResolution in drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
Test dependency resolution.
ModuleEnable::testRequiredModuleSchemaVersions in drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleEnable.php
Tests recorded schema versions of early installed modules in the installer.
module_enable in drupal/core/includes/module.inc
Enables or installs a given list of modules.

... See full list

File

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

Code

function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
  static $versions = array();
  if ($reset) {
    $versions = array();
  }
  if (!$versions) {
    if (!($versions = drupal_container()
      ->get('keyvalue')
      ->get('system.schema')
      ->getAll())) {
      $versions = array();
    }
  }
  if ($array) {
    return $versions;
  }
  else {
    return isset($versions[$module]) ? $versions[$module] : SCHEMA_UNINSTALLED;
  }
}