| 1 install.inc | backdrop_get_installed_schema_version($module, $reset = FALSE, $array = FALSE) |
Returns the currently installed schema version for a module.
Parameters
string|null $module: A module name.
bool $reset: Set to TRUE after modifying the system table.
bool $array: Set to TRUE if you want to get information about all modules in the system.
Return value
int|array: The currently installed schema version, or SCHEMA_UNINSTALLED if the module is not installed. Or an array of all module version info.
File
- core/
includes/ install.inc, line 160 - API functions for installing modules and themes.
Code
function backdrop_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 ($module && isset($versions[$module])) ? $versions[$module] : SCHEMA_UNINSTALLED;
}
}