8.5.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
8.0.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
8.1.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
8.2.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
8.3.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
8.4.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
8.6.x schema.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
4.7.x install.inc drupal_get_installed_schema_version($module, $reset = FALSE)
5.x install.inc drupal_get_installed_schema_version($module, $reset = FALSE)
6.x install.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
7.x install.inc drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)

Returns the currently installed schema version for a module.

Parameters

$module: A module name.

$reset: Set to TRUE after modifying the system table.

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

Return value

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

9 calls to drupal_get_installed_schema_version()
drupal_set_installed_schema_version in includes/install.inc
Update the installed version information for a module.
ModuleUnitTest::testDependencyResolution in modules/simpletest/tests/module.test
Test dependency resolution.
system_requirements in modules/system/system.install
Implements hook_requirements().
UpdateScriptFunctionalTest::testRequirements in modules/system/system.test
Tests that requirements warnings and errors are correctly displayed.
UpdateScriptFunctionalTest::testSuccessfulUpdateFunctionality in modules/system/system.test
Tests update.php after performing a successful update.

... See full list

File

includes/install.inc, line 146
API functions for installing modules and themes.

Code

function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
  static $versions = array();
  if ($reset) {
    $versions = array();
  }
  if (!$versions) {
    $versions = array();
    $result = db_query("SELECT name, schema_version FROM {system} WHERE type = :type", array(
      ':type' => 'module',
    ));
    foreach ($result as $row) {
      $versions[$row->name] = $row->schema_version;
    }
  }
  if ($array) {
    return $versions;
  }
  else {
    return isset($versions[$module]) ? $versions[$module] : SCHEMA_UNINSTALLED;
  }
}