drupal_get_installed_schema_version

Versions
4.7 – 5
drupal_get_installed_schema_version($module, $reset = FALSE)
6 – 7
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.

▾ 8 functions call drupal_get_installed_schema_version()

drupal_load_updates in includes/install.inc
Initialize the update system by loading all installed module's .install files.
node_update_7003 in modules/node/node.install
Remove the node_counter if the statistics module is uninstalled.
system_modules_submit in modules/system/system.admin.inc
Submit callback; handles modules form submission.
system_requirements in modules/system/system.install
Test and report Drupal installation requirements.
update_fix_d7_install_profile in includes/update.inc
Register the currently installed profile in the system table.
update_fix_d7_requirements in includes/update.inc
Perform Drupal 6.x to 7.x updates that are required for update.php to function properly.
update_get_update_list in includes/update.inc
Return a list of all the pending database updates.
_drupal_install_module in includes/install.inc
Callback to install an individual install profile module.

Code

includes/install.inc, line 135

<?php
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;
    }
  }

  return $array ? $versions : $versions[$module];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.