You are here

function drupal_get_installed_schema_version in Drupal 7

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. 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, or SCHEMA_UNINSTALLED if the module is not installed.

16 calls to drupal_get_installed_schema_version()
drupal_load_updates in includes/install.inc
Loads .install files for installed modules to initialize the update system.
drupal_set_installed_schema_version in includes/install.inc
Update the installed version information for a module.
drupal_uninstall_modules in includes/install.inc
Uninstalls a given list of disabled modules.
ModuleUnitTest::testDependencyResolution in modules/simpletest/tests/module.test
Test dependency resolution.
module_enable in includes/module.inc
Enables or installs a given list of modules.

... 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;
  }
}