diff --git a/database/database.mysql b/database/database.mysql
index d29567b9b799559a2b89a30125285576e1c6c623..5cbc889f35fb4d3f765673c0af0e3e5be910d176 100644
--- a/database/database.mysql
+++ b/database/database.mysql
@@ -656,7 +656,7 @@ CREATE TABLE system (
   status int(2) NOT NULL default '0',
   throttle tinyint(1) DEFAULT '0' NOT NULL,
   bootstrap int(2) NOT NULL default '0',
-  schema_version smallint(2) unsigned NOT NULL,
+  schema_version smallint(2) unsigned NOT NULL default 0,
   PRIMARY KEY (filename)
 ) TYPE=MyISAM;
 
@@ -818,20 +818,20 @@ CREATE TABLE watchdog (
 -- Insert some default values
 --
 
-INSERT INTO system VALUES ('modules/block.module','block','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/comment.module','comment','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/filter.module','filter','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/help.module','help','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/menu.module','menu','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/node.module','node','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/page.module','page','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/system.module','system','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/user.module','user','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/watchdog.module','watchdog','module','',1,0,0,1);
-INSERT INTO system VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine','', 1,0,0,1);
-INSERT INTO system VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1,0,0,1);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/block.module', 'block', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/comment.module', 'comment', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/filter.module', 'filter', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/help.module', 'help', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/menu.module', 'menu', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/node.module', 'node', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/page.module', 'page', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/story.module', 'story', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/system.module', 'system', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/taxonomy.module', 'taxonomy', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/user.module', 'user', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/watchdog.module', 'watchdog', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, 0);
 INSERT INTO users (uid, name, mail) VALUES ('0', '', '');
 INSERT INTO users_roles (uid, rid) VALUES (0, 1);
 
@@ -841,8 +841,6 @@ INSERT INTO permission VALUES (1,'access content',0);
 INSERT INTO role (rid, name) VALUES (2, 'authenticated user');
 INSERT INTO permission VALUES (2,'access comments, access content, post comments, post comments without approval',0);
 
-REPLACE variable SET name='update_start', value='s:10:"2005-03-21";';
-
 REPLACE variable SET name='theme_default', value='s:10:"bluemarine";';
 
 REPLACE blocks SET module = 'user', delta = '0', theme = 'bluemarine', status = '1';
diff --git a/database/database.pgsql b/database/database.pgsql
index 27e5997dd5392611cda569b9f807729678c47355..fc992e2f92c47ed57b2b51097915286dad4f3692 100644
--- a/database/database.pgsql
+++ b/database/database.pgsql
@@ -650,7 +650,7 @@ CREATE TABLE system (
   status integer NOT NULL default '0',
   throttle smallint NOT NULL default '0',
   bootstrap integer NOT NULL default '0',
-  schema_version smallint NOT NULL default 1,
+  schema_version smallint NOT NULL default 0,
   PRIMARY KEY (filename)
 );
 
@@ -814,22 +814,21 @@ CREATE TABLE watchdog (
 -- Insert some default values
 --
 
-INSERT INTO system VALUES ('modules/block.module','block','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/comment.module','comment','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/filter.module','filter','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/help.module','help','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/menu.module','menu','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/node.module','node','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/page.module','page','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/story.module','story','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/system.module','system','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/taxonomy.module','taxonomy','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/user.module','user','module','',1,0,0,1);
-INSERT INTO system VALUES ('modules/watchdog.module','watchdog','module','',1,0,0,1);
-INSERT INTO system VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine','',1,0,0,1);
-INSERT INTO system VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine',1,0,0,1);
-
-INSERT INTO variable(name,value) VALUES('update_start', 's:10:"2005-03-21";');
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/block.module', 'block', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/comment.module', 'comment', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/filter.module', 'filter', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/help.module', 'help', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/menu.module', 'menu', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/node.module', 'node', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/page.module', 'page', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/story.module', 'story', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/system.module', 'system', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/taxonomy.module', 'taxonomy', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/user.module', 'user', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('modules/watchdog.module', 'watchdog', 'module', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/engines/phptemplate/phptemplate.engine', 'phptemplate', 'theme_engine', '', 1, 0, 0, 0);
+INSERT INTO system (filename, name, type, description, status, throttle, bootstrap, schema_version) VALUES ('themes/bluemarine/page.tpl.php', 'bluemarine', 'theme', 'themes/engines/phptemplate/phptemplate.engine', 1, 0, 0, 0);
+
 INSERT INTO variable(name,value) VALUES('theme_default','s:10:"bluemarine";');
 INSERT INTO users(uid,name,mail) VALUES(0,'','');
 INSERT INTO users_roles(uid,rid) VALUES(0, 1);
diff --git a/includes/install.inc b/includes/install.inc
new file mode 100644
index 0000000000000000000000000000000000000000..6f8a86f65c06a2f3772763deda9ce0c63f0e807c
--- /dev/null
+++ b/includes/install.inc
@@ -0,0 +1,75 @@
+<?php
+// $Id$
+
+define('SCHEMA', 0);
+define('SCHEMA_MIN', 1);
+
+
+// The system module (Drupal core) is currently a special case
+include_once './database/updates.inc';
+
+// Include install files for each module
+foreach (module_list() as $module) {
+  $install_file = './'. drupal_get_path('module', $module) .'/'. $module .'.install';
+  if (is_file($install_file)) {
+    include_once $install_file;
+  }
+}
+
+
+/**
+ * Returns an array of availiable schema versions for a module.
+ *
+ * @param $module
+ *   A module name.
+ * @return
+ *   If the module has updates, an array of available updates. Otherwise,
+ *   FALSE.
+ */
+function drupal_get_schema_versions($module) {
+  if (!($max = module_invoke($module, 'version', SCHEMA))) {
+    return FALSE;
+  }
+  if (!($min = module_invoke($module, 'version', SCHEMA_MIN))) {
+    $min = 1;
+  }
+  return range($min, $max);
+}
+
+/**
+ * Returns the currently installed schema version for a module.
+ *
+ * @param $module
+ *   A module name.
+ * @return
+ *   The currently installed schema version.
+ */
+function drupal_get_installed_schema_version($module, $reset = FALSE) {
+  static $versions;
+
+  if ($reset) {
+    unset($versions);
+  }
+
+  if (!$versions) {
+    $versions = array();
+    $result = db_query("SELECT name, schema_version FROM {system} WHERE type = 'module'");
+    while ($row = db_fetch_object($result)) {
+      $versions[$row->name] = $row->schema_version;
+    }
+  }
+
+  return $versions[$module];
+}
+
+/**
+ * Update the installed version information for a module.
+ *
+ * @param $module
+ *   A module name.
+ * @param $version
+ *   The new schema version.
+ */
+function drupal_set_installed_schema_version($module, $version) {
+  db_query("UPDATE {system} SET schema_version = %d WHERE name = '%s'", $version, $module);
+}
diff --git a/modules/system.module b/modules/system.module
index c9b6b52146ba60725318b6413543f7950f2fa1ff..94cd94035869eea34c736ab29ec071ecdc6cd9e7 100644
--- a/modules/system.module
+++ b/modules/system.module
@@ -484,7 +484,7 @@ function system_check_directory($form_element) {
  */
 function system_get_files_database(&$files, $type) {
   // Extract current files from database.
-  $result = db_query("SELECT name, type, status, throttle FROM {system} WHERE type = '%s'", $type);
+  $result = db_query("SELECT name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
   while ($file = db_fetch_object($result)) {
     if (isset($files[$file->name]) && is_object($files[$file->name])) {
       foreach ($file as $key => $value) {
@@ -892,7 +892,7 @@ function system_modules() {
 
     // Update the contents of the system table:
     db_query("DELETE FROM {system} WHERE name = '%s' AND type = '%s'", $file->name, 'module');
-    db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap);
+    db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap, schema_version) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap, $file->schema_version);
   }
 
 
@@ -947,9 +947,13 @@ function theme_system_modules($form) {
 function system_modules_submit($form_id, $edit) {
   db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
 
+  $new_modules = array();
   foreach ($edit['status'] as $key => $choice) {
     if ($choice) {
       db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $key);
+      if (!module_exist($key)) {
+        $new_modules[] = $key;
+      }
     }
   }
 
@@ -961,7 +965,18 @@ function system_modules_submit($form_id, $edit) {
     }
   }
 
+  module_list(TRUE, FALSE);
   menu_rebuild();
+
+  include './includes/install.inc';
+  foreach ($new_modules as $module) {
+    // Set the installed schema version for newly-enabled modules
+    $versions = drupal_get_schema_versions($module);
+    if ($versions !== FALSE && drupal_get_installed_schema_version($module) == 0) {
+      drupal_set_installed_schema_version($module, max($versions));
+    }
+  }
+
   drupal_set_message(t('The configuration options have been saved.'));
   drupal_goto('admin/modules');
 }
diff --git a/modules/system/system.module b/modules/system/system.module
index c9b6b52146ba60725318b6413543f7950f2fa1ff..94cd94035869eea34c736ab29ec071ecdc6cd9e7 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -484,7 +484,7 @@ function system_check_directory($form_element) {
  */
 function system_get_files_database(&$files, $type) {
   // Extract current files from database.
-  $result = db_query("SELECT name, type, status, throttle FROM {system} WHERE type = '%s'", $type);
+  $result = db_query("SELECT name, type, status, throttle, schema_version FROM {system} WHERE type = '%s'", $type);
   while ($file = db_fetch_object($result)) {
     if (isset($files[$file->name]) && is_object($files[$file->name])) {
       foreach ($file as $key => $value) {
@@ -892,7 +892,7 @@ function system_modules() {
 
     // Update the contents of the system table:
     db_query("DELETE FROM {system} WHERE name = '%s' AND type = '%s'", $file->name, 'module');
-    db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap);
+    db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap, schema_version) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $file->name, $file->description, 'module', $file->filename, $file->status, $file->throttle, $bootstrap, $file->schema_version);
   }
 
 
@@ -947,9 +947,13 @@ function theme_system_modules($form) {
 function system_modules_submit($form_id, $edit) {
   db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
 
+  $new_modules = array();
   foreach ($edit['status'] as $key => $choice) {
     if ($choice) {
       db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $key);
+      if (!module_exist($key)) {
+        $new_modules[] = $key;
+      }
     }
   }
 
@@ -961,7 +965,18 @@ function system_modules_submit($form_id, $edit) {
     }
   }
 
+  module_list(TRUE, FALSE);
   menu_rebuild();
+
+  include './includes/install.inc';
+  foreach ($new_modules as $module) {
+    // Set the installed schema version for newly-enabled modules
+    $versions = drupal_get_schema_versions($module);
+    if ($versions !== FALSE && drupal_get_installed_schema_version($module) == 0) {
+      drupal_set_installed_schema_version($module, max($versions));
+    }
+  }
+
   drupal_set_message(t('The configuration options have been saved.'));
   drupal_goto('admin/modules');
 }
diff --git a/modules/user.module b/modules/user.module
index a85358eafd2ee2d7ec4aa0db17c57e6b610a3697..4ade502e4061c3e60dec93076b144baefb221c36 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -1123,6 +1123,11 @@ function user_register_submit($form_id, $form_values) {
     user_mail($mail, t('drupal user account details for %s', array('%s' => $name)), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n  username: %username\n  password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
     drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access.  All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings'))));
     user_authenticate($account->name, trim($pass));
+
+    // Set the installed schema version of the system module to the most recent version.
+    include_once './includes/install.inc';
+    drupal_set_installed_schema_version('system', max(drupal_get_schema_versions('system')));
+
     drupal_goto('user/1/edit');
   }
   else {
diff --git a/modules/user/user.module b/modules/user/user.module
index a85358eafd2ee2d7ec4aa0db17c57e6b610a3697..4ade502e4061c3e60dec93076b144baefb221c36 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -1123,6 +1123,11 @@ function user_register_submit($form_id, $form_values) {
     user_mail($mail, t('drupal user account details for %s', array('%s' => $name)), strtr(t("%username,\n\nYou may now login to %uri using the following username and password:\n\n  username: %username\n  password: %password\n\n%edit_uri\n\n--drupal"), $variables), "From: $from\nReply-to: $from\nX-Mailer: Drupal\nReturn-path: $from\nErrors-to: $from");
     drupal_set_message(t('<p>Welcome to Drupal. You are user #1, which gives you full and immediate access.  All future registrants will receive their passwords via e-mail, so please make sure your website e-mail address is set properly under the general settings on the <a href="%settings">settings page</a>.</p><p> Your password is <strong>%pass</strong>. You may change your password below.</p>', array('%pass' => $pass, '%settings' => url('admin/settings'))));
     user_authenticate($account->name, trim($pass));
+
+    // Set the installed schema version of the system module to the most recent version.
+    include_once './includes/install.inc';
+    drupal_set_installed_schema_version('system', max(drupal_get_schema_versions('system')));
+
     drupal_goto('user/1/edit');
   }
   else {
diff --git a/update.php b/update.php
index b3a79a844012e49eda99373430d5add43e5b60f2..fb8730718aeadab88e314e5b907304e834211375 100644
--- a/update.php
+++ b/update.php
@@ -18,24 +18,6 @@
 $access_check = TRUE;
 
 
-define('SCHEMA', 0);
-define('SCHEMA_MIN', 1);
-
-/**
- * Includes install files.
- */
-function update_include_install_files() {
-  // The system module (Drupal core) is currently a special case
-  include_once './database/updates.inc';
-
-  foreach (module_list() as $module) {
-    $install_file = './'. drupal_get_path('module', $module) .'/'. $module .'.install';
-    if (is_file($install_file)) {
-      include_once $install_file;
-    }
-  }
-}
-
 function update_sql($sql) {
   $result = db_query($sql);
   return array('success' => $result !== FALSE, 'query' => check_plain($sql));
@@ -204,7 +186,7 @@ function update_fix_schema_version() {
         break;
     }
 
-    update_set_installed_version('system', $sql_updates[$update_start]);
+    drupal_set_installed_schema_version('system', $sql_updates[$update_start]);
     variable_del('update_start');
   }
 }
@@ -220,7 +202,7 @@ function update_fix_schema_version() {
 function update_fix_sessions() {
   $ret = array();
 
-  if (update_get_installed_version('system') < 130 && !variable_get('update_sessions_fixed', FALSE)) {
+  if (drupal_get_installed_schema_version('system') < 130 && !variable_get('update_sessions_fixed', FALSE)) {
     if ($GLOBALS['db_type'] == 'mysql') {
       db_query("ALTER TABLE {sessions} ADD cache int(11) NOT NULL default '0' AFTER timestamp");
     }
@@ -240,7 +222,7 @@ function update_fix_sessions() {
  * when update 142 is removed. It is part of the Drupal 4.6 to 4.7 migration.
  */
 function update_fix_watchdog() {
-  if (update_get_installed_version('system') < 142 && !variable_get('update_watchdog_fixed', FALSE)) {
+  if (drupal_get_installed_schema_version('system') < 142 && !variable_get('update_watchdog_fixed', FALSE)) {
     switch ($GLOBALS['db_type']) {
       case 'pgsql':
         $ret = array();
@@ -269,64 +251,7 @@ function update_data($module, $number) {
   $_SESSION['update_results'][$module][$number] = $ret;
 
   // Update the installed version
-  update_set_installed_version($module, $number);
-}
-
-/**
- * Returns an array of availiable schema versions for a module.
- *
- * @param $module
- *   A module name.
- * @return
- *   If the module has updates, an array of available updates. Otherwise,
- *   FALSE.
- */
-function update_get_versions($module) {
-  if (!($max = module_invoke($module, 'version', SCHEMA))) {
-    return FALSE;
-  }
-  if (!($min = module_invoke($module, 'version', SCHEMA_MIN))) {
-    $min = 1;
-  }
-  return range($min, $max);
-}
-
-/**
- * Returns the currently installed schema version for a module.
- *
- * @param $module
- *   A module name.
- * @return
- *   The currently installed schema version.
- */
-function update_get_installed_version($module, $reset = FALSE) {
-  static $versions;
-
-  if ($reset) {
-    unset($versions);
-  }
-
-  if (!$versions) {
-    $versions = array();
-    $result = db_query("SELECT name, schema_version FROM {system} WHERE type = 'module'");
-    while ($row = db_fetch_object($result)) {
-      $versions[$row->name] = $row->schema_version;
-    }
-  }
-
-  return $versions[$module];
-}
-
-/**
- * Update the installed version information for a module.
- *
- * @param $module
- *   A module name.
- * @param $version
- *   The new schema version.
- */
-function update_set_installed_version($module, $version) {
-  db_query("UPDATE {system} SET schema_version = %d WHERE name = '%s'", $version, $module);
+  drupal_set_installed_schema_version($module, $number);
 }
 
 function update_selection_page() {
@@ -343,13 +268,13 @@ function update_selection_page() {
   );
   foreach (module_list() as $module) {
     if (module_hook($module, 'version')) {
-      $updates = drupal_map_assoc(update_get_versions($module));
+      $updates = drupal_map_assoc(drupal_get_schema_versions($module));
       $updates[] = 'No updates available';
 
       $form['start'][$module] = array(
         '#type' => 'select',
         '#title' => t('%name module', array('%name' => $module)),
-        '#default_value' => array_search(update_get_installed_version($module), $updates) + 1,
+        '#default_value' => array_search(drupal_get_installed_schema_version($module), $updates) + 1,
         '#options' => $updates,
       );
     }
@@ -375,8 +300,8 @@ function update_update_page() {
   // Set the installed version so updates start at the correct place.
   $_SESSION['update_remaining'] = array();
   foreach ($_POST['edit']['start'] as $module => $version) {
-    update_set_installed_version($module, $version - 1);
-    $max_version = max(update_get_versions($module));
+    drupal_set_installed_schema_version($module, $version - 1);
+    $max_version = max(drupal_get_schema_versions($module));
     if ($version <= $max_version) {
       foreach (range($version, $max_version) as $update) {
         $_SESSION['update_remaining'][] = array('module' => $module, 'version' => $update);
@@ -541,7 +466,7 @@ function update_access_denied_page() {
 
 // Access check:
 if (($access_check == FALSE) || ($user->uid == 1)) {
-  update_include_install_files();
+  include_once './includes/install.inc';
 
   update_fix_schema_version();
   update_fix_sessions();