On this page
function drupal_get_installed_schema_version
drupal_get_installed_schema_version($module, $reset = FALSE, $array = FALSE)
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.
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;
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!install.inc/function/drupal_get_installed_schema_version/7.x