function drupal_get_installed_schema_version

Same name in other branches
  1. 7.x includes/install.inc \drupal_get_installed_schema_version()
  2. 8.9.x 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.

Deprecated

in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion() or \Drupal\Core\Update\UpdateHookRegistry::getAllInstalledVersions() instead.

See also

https://www.drupal.org/node/2444417

\Drupal\Core\Update\UpdateHookRegistry::getInstalledVersion()

Related topics

1 call to drupal_get_installed_schema_version()
UpdateDeprecationTest::testDrupalGetInstalledSchemaVersion in core/tests/Drupal/KernelTests/Core/Extension/UpdateDeprecationTest.php
Deprecation testing for drupal installed schema version functions.

File

core/includes/schema.inc, line 70

Code

function drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) {
    @trigger_error('drupal_get_installed_schema_version() is deprecated in drupal:9.3.0 and is removed from drupal:10.0.0. Use \\Drupal\\Core\\Update\\UpdateHookRegistry::getInstalledVersion() or \\Drupal\\Core\\Update\\UpdateHookRegistry::getAllInstalledVersions() instead. See https://www.drupal.org/node/2444417', E_USER_DEPRECATED);
    
    /** @var \Drupal\Core\Update\UpdateHookRegistry $service */
    $service = \Drupal::service('update.update_hook_registry');
    if ($array) {
        return $service->getAllInstalledVersions();
    }
    return $service->getInstalledVersion((string) $module);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.