You are here

function drupal_get_installed_schema_version in Drupal 8

Same name and namespace in other branches
  1. 4 includes/install.inc \drupal_get_installed_schema_version()
  2. 5 includes/install.inc \drupal_get_installed_schema_version()
  3. 6 includes/install.inc \drupal_get_installed_schema_version()
  4. 7 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

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

27 calls to drupal_get_installed_schema_version()
block_post_update_disable_blocks_with_missing_contexts in core/modules/block/block.post_update.php
Disable all blocks with missing context IDs in block_update_8001().
comment_requirements in core/modules/comment/comment.install
Implements hook_requirements().
drupal_load_updates in core/includes/install.inc
Loads .install files for installed modules to initialize the update system.
drupal_set_installed_schema_version in core/includes/schema.inc
Updates the installed version information for a module.
InstallTest::testRequiredModuleSchemaVersions in core/modules/system/tests/src/Functional/Module/InstallTest.php
Tests recorded schema versions of early installed modules in the installer.

... See full list

2 string references to 'drupal_get_installed_schema_version'
UpdatePathTestBase::runUpdates in core/modules/system/src/Tests/Update/UpdatePathTestBase.php
Helper function to run pending database updates.
update_set_schema in core/includes/update.inc
Forces a module to a given schema version.

File

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

Code

function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
  $versions =& drupal_static(__FUNCTION__, []);
  if ($reset) {
    $versions = [];
  }
  if (!$versions) {
    if (!($versions = \Drupal::keyValue('system.schema')
      ->getAll())) {
      $versions = [];
    }
  }
  if ($array) {
    return $versions;
  }
  else {
    return isset($versions[$module]) ? $versions[$module] : SCHEMA_UNINSTALLED;
  }
}