You are here

function drupal_get_installed_schema_version in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 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

21 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().
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/src/Tests/Module/InstallTest.php
Tests recorded schema versions of early installed modules in the installer.
ModuleHandlerTest::testDependencyResolution in core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
Tests dependency resolution.

... See full list

File

core/includes/schema.inc, line 76
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::keyValue('system.schema')
      ->getAll())) {
      $versions = array();
    }
  }
  if ($array) {
    return $versions;
  }
  else {
    return isset($versions[$module]) ? $versions[$module] : SCHEMA_UNINSTALLED;
  }
}