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

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.

2 calls to drupal_get_installed_schema_version()
system_requirements in modules/system/system.install
Implementation of hook_requirements().
update_script_selection_form in ./update.php

File

includes/install.inc, line 71

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 = '%s'", 'module');
    while ($row = db_fetch_object($result)) {
      $versions[$row->name] = $row->schema_version;
    }
  }
  return $array ? $versions : $versions[$module];
}