Index: includes/batch.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/batch.inc,v
retrieving revision 1.28
diff -u -p -r1.28 batch.inc
--- includes/batch.inc	10 Nov 2008 05:22:56 -0000	1.28
+++ includes/batch.inc	13 Nov 2008 13:10:54 -0000
@@ -194,7 +194,7 @@ function _batch_process() {
     // We assume a single pass operation and set the completion level
     // to 1 by default.
     $finished = 1;
-    if ((list($function, $args) = reset($current_set['operations'])) && function_exists($function)) {
+    if ((list($function, $args) = reset($current_set['operations'])) && drupal_function_exists($function)) {
       // Build the 'context' array, execute the function call,
       // and retrieve the user message.
       $batch_context = array('sandbox' => &$current_set['sandbox'], 'results' => &$current_set['results'], 'finished' => &$finished, 'message' => &$task_message);
@@ -289,7 +289,7 @@ function _batch_next_set() {
   if (isset($batch['sets'][$batch['current_set'] + 1])) {
     $batch['current_set']++;
     $current_set =& _batch_current_set();
-    if (isset($current_set['form_submit']) && ($function = $current_set['form_submit']) && function_exists($function)) {
+    if (isset($current_set['form_submit']) && ($function = $current_set['form_submit']) && drupal_function_exists($function)) {
       // We use our stored copies of $form and $form_state, to account for
       // possible alteration by the submit handlers.
       $function($batch['form'], $batch['form_state']);
@@ -313,7 +313,7 @@ function _batch_finished() {
       if (isset($batch_set['file']) && is_file($batch_set['file'])) {
         include_once DRUPAL_ROOT . '/' . $batch_set['file'];
       }
-      if (function_exists($batch_set['finished'])) {
+      if (drupal_function_exists($batch_set['finished'])) {
         $batch_set['finished']($batch_set['success'], $batch_set['results'], $batch_set['operations']);
       }
     }
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.824
diff -u -p -r1.824 common.inc
--- includes/common.inc	11 Nov 2008 22:39:58 -0000	1.824
+++ includes/common.inc	13 Nov 2008 13:10:56 -0000
@@ -2726,7 +2726,22 @@ function _drupal_bootstrap_full() {
   // Undo magic quotes
   fix_gpc_magic();
   // Load all enabled modules
-  module_load_all();
+  if (defined('MAINTENANCE_MODE')) {
+    module_load_all();
+  }
+  else {
+    $required_modules = array(
+      'user',
+      'filter',
+      'node',
+      'menu',
+      'block',
+      'system',
+    );
+    foreach ($required_modules as $module) {
+      require_once DRUPAL_ROOT . "/modules/$module/$module.module";
+    }
+  }
 
   // Let all modules take action before menu system handles the request
   // We do not want this while running update.php.
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.194
diff -u -p -r1.194 locale.inc
--- includes/locale.inc	11 Nov 2008 20:22:17 -0000	1.194
+++ includes/locale.inc	13 Nov 2008 13:10:58 -0000
@@ -2,6 +2,16 @@
 // $Id: locale.inc,v 1.194 2008/11/11 20:22:17 dries Exp $
 
 /**
+ * Language written left to right. Possible value of $language->direction.
+ */
+define('LANGUAGE_LTR', 0);
+
+/**
+ * Language written right to left. Possible value of $language->direction.
+ */
+define('LANGUAGE_RTL', 1);
+
+/**
  * @file
  * Administration functions for locale.module.
  */
@@ -545,7 +555,9 @@ function locale_translate_seek_screen() 
  */
 function locale_translate_seek_form() {
   // Get all languages, except English
-  $languages = locale_language_list('name', TRUE);
+  if (drupal_function_exists('locale_language_list')) {
+    $languages = locale_language_list('name', TRUE);
+  }
   unset($languages['en']);
 
   // Present edit form preserving previous user settings
@@ -598,7 +610,9 @@ function locale_translate_seek_form() {
  */
 function locale_translate_import_form() {
   // Get all languages, except English
-  $names = locale_language_list('name', TRUE);
+  if (drupal_function_exists('locale_language_list')) {
+    $names = locale_language_list('name', TRUE);
+  }
   unset($names['en']);
 
   if (!count($names)) {
Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.305
diff -u -p -r1.305 menu.inc
--- includes/menu.inc	13 Nov 2008 05:54:35 -0000	1.305
+++ includes/menu.inc	13 Nov 2008 13:10:59 -0000
@@ -458,7 +458,9 @@ function _menu_load_objects(&$item, &$ma
           $return = call_user_func_array($function, $args);
         }
         else {
-          $return = $function($value);
+          if (drupal_function_exists($function)) {
+            $return = $function($value);
+          }
         }
         // If callback returned an error or there is no callback, trigger 404.
         if ($return === FALSE) {
@@ -500,7 +502,9 @@ function _menu_check_access(&$item, $map
       $item['access'] = (count($arguments) == 1) ? user_access($arguments[0]) : user_access($arguments[0], $arguments[1]);
     }
     else {
-      $item['access'] = call_user_func_array($callback, $arguments);
+      if (drupal_function_exists($callback)) {
+        $item['access'] = call_user_func_array($callback, $arguments);
+      }
     }
   }
 }
@@ -1220,17 +1224,15 @@ function menu_get_active_help() {
   $arg = drupal_help_arg(arg(NULL));
   $empty_arg = drupal_help_arg();
 
-  foreach (module_list() as $name) {
-    if (module_hook($name, 'help')) {
-      // Lookup help for this path.
-      if ($help = module_invoke($name, 'help', $router_path, $arg)) {
-        $output .= $help . "\n";
-      }
-      // Add "more help" link on admin pages if the module provides a
-      // standalone help page.
-      if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#' . $arg[2], $empty_arg) && $help) {
-        $output .= theme("more_help_link", url('admin/help/' . $arg[2]));
-      }
+  foreach (module_implements('help') as $name) {
+    // Lookup help for this path.
+    if ($help = module_invoke($name, 'help', $router_path, $arg)) {
+      $output .= $help . "\n";
+    }
+    // Add "more help" link on admin pages if the module provides a
+    // standalone help page.
+    if ($arg[0] == "admin" && module_exists('help') && module_invoke($name, 'help', 'admin/help#' . $arg[2], $empty_arg) && $help) {
+      $output .= theme("more_help_link", url('admin/help/' . $arg[2]));
     }
   }
   return $output;
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.133
diff -u -p -r1.133 module.inc
--- includes/module.inc	11 Nov 2008 22:39:58 -0000	1.133
+++ includes/module.inc	13 Nov 2008 13:10:59 -0000
@@ -225,7 +225,7 @@ function _module_build_dependencies($fil
  *   TRUE if the module is both installed and enabled.
  */
 function module_exists($module) {
-  $list = module_list();
+  $list = module_list(FALSE, FALSE);
   return isset($list[$module]);
 }
 
Index: modules/comment/comment.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.admin.inc,v
retrieving revision 1.11
diff -u -p -r1.11 comment.admin.inc
--- modules/comment/comment.admin.inc	11 Nov 2008 21:44:01 -0000	1.11
+++ modules/comment/comment.admin.inc	13 Nov 2008 13:10:59 -0000
@@ -43,7 +43,7 @@ function comment_admin_overview($type = 
     '#suffix' => '</div>',
   );
   $options = array();
-  foreach (comment_operations($arg == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
+  foreach (module_invoke('comment', 'operations', $arg == 'approval' ? 'publish' : 'unpublish') as $key => $value) {
     $options[$key] = $value[0];
   }
   $form['options']['operation'] = array(
@@ -131,7 +131,9 @@ function comment_admin_overview_submit($
         $query
           ->condition('cid', $cid )
           ->execute();
-        $comment = comment_load($cid);
+        if (drupal_function_exists('comment_load')) {
+          $comment = comment_load($cid);
+        }
         _comment_update_node_statistics($comment->nid);
         // Allow modules to respond to the updating of a comment.
         comment_invoke_comment($comment, $form_state['values']['operation']);
@@ -201,7 +203,9 @@ function comment_multiple_delete_confirm
   // array_filter() returns only elements with actual values.
   $comment_counter = 0;
   foreach (array_filter($edit['comments']) as $cid => $value) {
-    $comment = comment_load($cid);
+    if (drupal_function_exists('comment_load')) {
+      $comment = comment_load($cid);
+    }
     if (is_object($comment) && is_numeric($comment->cid)) {
       $subject = db_result(db_query('SELECT subject FROM {comments} WHERE cid = %d', $cid));
       $form['comments'][$cid] = array('#type' => 'hidden', '#value' => $cid, '#prefix' => '<li>', '#suffix' => check_plain($subject) . '</li>');
@@ -228,7 +232,9 @@ function comment_multiple_delete_confirm
 function comment_multiple_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
     foreach ($form_state['values']['comments'] as $cid => $value) {
-      $comment = comment_load($cid);
+      if (drupal_function_exists('comment_load')) {
+        $comment = comment_load($cid);
+      }
       // Perform the actual comment deletion.
       _comment_delete_thread($comment);
       _comment_update_node_statistics($comment->nid);
Index: modules/comment/comment.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v
retrieving revision 1.8
diff -u -p -r1.8 comment.pages.inc
--- modules/comment/comment.pages.inc	11 Nov 2008 21:44:01 -0000	1.8
+++ modules/comment/comment.pages.inc	13 Nov 2008 13:10:59 -0000
@@ -19,7 +19,7 @@ function comment_edit($cid) {
   $comment = drupal_unpack($comment);
   $comment->name = $comment->uid ? $comment->registered_name : $comment->name;
 
-  if (comment_access('edit', $comment)) {
+  if (drupal_function_exists('comment_access') && comment_access('edit', $comment)) {
     return comment_form_box((array)$comment);
   }
   else {
@@ -124,7 +124,7 @@ function comment_reply($node, $pid = NUL
  */
 function comment_approve($cid) {
   // Load the comment whose cid = $cid
-  if ($comment = comment_load($cid)) {
+  if (drupal_function_exists('comment_load') && $comment = comment_load($cid)) {
     $operations = comment_operations('publish');
     $query = $operations['publish'][1];
     $query
Index: modules/contact/contact.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/contact/contact.pages.inc,v
retrieving revision 1.15
diff -u -p -r1.15 contact.pages.inc
--- modules/contact/contact.pages.inc	13 Oct 2008 00:33:02 -0000	1.15
+++ modules/contact/contact.pages.inc	13 Nov 2008 13:10:59 -0000
@@ -126,7 +126,9 @@ function contact_mail_page_submit($form,
   $from = $values['mail'];
 
   // Load category properties and save form values for email composition.
-  $contact = contact_load($values['cid']);
+  if (drupal_function_exists('contact_load')) {
+    $contact = contact_load($values['cid']);
+  }
   $values['contact'] = $contact;
 
   // Send the e-mail to the recipients using the site default language.
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.233
diff -u -p -r1.233 filter.module
--- modules/filter/filter.module	11 Nov 2008 16:49:37 -0000	1.233
+++ modules/filter/filter.module	13 Nov 2008 13:11:00 -0000
@@ -326,7 +326,7 @@ function filter_formats($index = NULL) {
 function filter_list_all() {
   $filters = array();
 
-  foreach (module_list() as $module) {
+  foreach (module_implements('filter') as $module) {
     $list = module_invoke($module, 'filter', 'list');
     if (isset($list) && is_array($list)) {
       foreach ($list as $delta => $name) {
Index: modules/forum/forum.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v
retrieving revision 1.15
diff -u -p -r1.15 forum.admin.inc
--- modules/forum/forum.admin.inc	5 Nov 2008 14:08:11 -0000	1.15
+++ modules/forum/forum.admin.inc	13 Nov 2008 13:11:00 -0000
@@ -219,7 +219,7 @@ function forum_overview(&$form_state) {
   module_load_include('inc', 'taxonomy', 'taxonomy.admin');
 
   $vid = variable_get('forum_nav_vocabulary', '');
-  $vocabulary = taxonomy_vocabulary_load($vid);
+  $vocabulary = module_invoke('taxonomy', 'vocabulary_load', $vid);
   $form = taxonomy_overview_terms($form_state, $vocabulary);
   drupal_set_title('Forums');
 
@@ -256,7 +256,7 @@ function forum_overview(&$form_state) {
  */
 function _forum_parent_select($tid, $title, $child_type) {
 
-  $parents = taxonomy_get_parents($tid);
+  $parents = module_invoke('taxonomy', 'get_parents', $tid);
   if ($parents) {
     $parent = array_shift($parents);
     $parent = $parent->tid;
Index: modules/forum/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v
retrieving revision 1.473
diff -u -p -r1.473 forum.module
--- modules/forum/forum.module	11 Nov 2008 16:49:37 -0000	1.473
+++ modules/forum/forum.module	13 Nov 2008 13:11:00 -0000
@@ -223,7 +223,7 @@ function forum_nodeapi_view(&$node, $tea
  */
 function forum_nodeapi_prepare(&$node, $teaser, $page) {
   $vid = variable_get('forum_nav_vocabulary', '');
-  $vocabulary = taxonomy_vocabulary_load($vid);
+  $vocabulary = module_invoke('taxonomy', 'vocabulary_load', $vid);
   if (_forum_nodeapi_check_node_type($node, $vocabulary)) {
     if (empty($node->nid)) {
       // New topic
@@ -555,7 +555,7 @@ function forum_get_forums($tid = 0) {
 
   $forums = array();
   $vid = variable_get('forum_nav_vocabulary', '');
-  $_forums = taxonomy_get_tree($vid, $tid);
+  $_forums = module_invoke('taxonomy', 'get_tree', $vid, $tid);
 
   if (count($_forums)) {
 
@@ -648,7 +648,7 @@ function forum_get_topics($tid, $sortby,
       }
       else {
         $history = _forum_user_last_visit($topic->nid);
-        $topic->new_replies = comment_num_new($topic->nid, $history);
+        $topic->new_replies = module_invoke('comment', 'num_new', $topic->nid, $history);
         $topic->new = $topic->new_replies || ($topic->timestamp > $history);
       }
     }
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.231
diff -u -p -r1.231 locale.module
--- modules/locale/locale.module	10 Nov 2008 05:22:59 -0000	1.231
+++ modules/locale/locale.module	13 Nov 2008 13:11:01 -0000
@@ -12,17 +12,6 @@
  *   Gettext portable object files are supported.
  */
 
-/**
- * Language written left to right. Possible value of $language->direction.
- */
-define('LANGUAGE_LTR', 0);
-
-/**
- * Language written right to left. Possible value of $language->direction.
- */
-define('LANGUAGE_RTL', 1);
-
-
 // ---------------------------------------------------------------------------------
 // Hook implementations
 
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.14
diff -u -p -r1.14 path.admin.inc
--- modules/path/path.admin.inc	13 Oct 2008 00:33:03 -0000	1.14
+++ modules/path/path.admin.inc	13 Nov 2008 13:11:01 -0000
@@ -64,7 +64,7 @@ function path_admin_overview($keys = NUL
  * Menu callback; handles pages for creating and editing URL aliases.
  */
 function path_admin_edit($pid = 0) {
-  if ($pid) {
+  if ($pid && drupal_function_exists('path_load')) {
     $alias = path_load($pid);
     drupal_set_title($alias['dst']);
     $output = drupal_get_form('path_admin_form', $alias);
@@ -159,7 +159,9 @@ function path_admin_form_submit($form, &
  * Menu callback; confirms deleting an URL alias
  */
 function path_admin_delete_confirm($form_state, $pid) {
-  $path = path_load($pid);
+  if (drupal_function_exists('path_load')) {
+    $path = path_load($pid);
+  }
   if (user_access('administer url aliases')) {
     $form['pid'] = array('#type' => 'value', '#value' => $pid);
     $output = confirm_form($form,
Index: modules/profile/profile.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.admin.inc,v
retrieving revision 1.17
diff -u -p -r1.17 profile.admin.inc
--- modules/profile/profile.admin.inc	13 Oct 2008 00:33:04 -0000	1.17
+++ modules/profile/profile.admin.inc	13 Nov 2008 13:11:01 -0000
@@ -3,6 +3,36 @@
 
 /**
  * @file
+ * Support for configurable user profiles.
+ */
+
+/**
+ * Private field, content only available to privileged users.
+ */
+if (!defined('PROFILE_PRIVATE'))
+  define('PROFILE_PRIVATE', 1);
+
+/**
+ * Public field, content shown on profile page but not used on member list pages.
+ */
+if (!defined('PROFILE_PUBLIC'))
+  define('PROFILE_PUBLIC', 2);
+
+/**
+ * Public field, content shown on profile page and on member list pages.
+ */
+if (!defined('PROFILE_PUBLIC_LISTINGS'))
+  define('PROFILE_PUBLIC_LISTINGS', 3);
+
+/**
+ * Hidden profile field, only accessible by administrators, modules and themes.
+ */
+if (!defined('PROFILE_HIDDEN'))
+  define('PROFILE_HIDDEN', 4);
+
+
+/**
+ * @file
  * Administrative page callbacks for the profile module.
  */
 
@@ -54,8 +84,10 @@ function profile_admin_overview() {
 
   $addnewfields = '<h2>' . t('Add new field') . '</h2>';
   $addnewfields .= '<ul>';
-  foreach (_profile_field_types() as $key => $value) {
-    $addnewfields .= '<li>' . l($value, "admin/user/profile/add/$key") . '</li>';
+  if (drupal_function_exists('_profile_field_types')) {
+    foreach (_profile_field_types() as $key => $value) {
+      $addnewfields .= '<li>' . l($value, "admin/user/profile/add/$key") . '</li>';
+    }
   }
   $addnewfields .= '</ul>';
   $form['addnewfields'] = array('#markup' => $addnewfields);
@@ -187,7 +219,9 @@ function profile_field_form(&$form_state
     }
   }
   else {
-    $types = _profile_field_types();
+    if (drupal_function_exists('_profile_field_types')) {
+      $types = _profile_field_types();
+    }
     if (!isset($types[$arg])) {
       drupal_not_found();
       return;
Index: modules/profile/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.module,v
retrieving revision 1.246
diff -u -p -r1.246 profile.module
--- modules/profile/profile.module	12 Oct 2008 04:30:08 -0000	1.246
+++ modules/profile/profile.module	13 Nov 2008 13:11:03 -0000
@@ -9,22 +9,26 @@
 /**
  * Private field, content only available to privileged users.
  */
-define('PROFILE_PRIVATE', 1);
+if (!defined('PROFILE_PRIVATE'))
+  define('PROFILE_PRIVATE', 1);
 
 /**
  * Public field, content shown on profile page but not used on member list pages.
  */
-define('PROFILE_PUBLIC', 2);
+if (!defined('PROFILE_PUBLIC'))
+  define('PROFILE_PUBLIC', 2);
 
 /**
  * Public field, content shown on profile page and on member list pages.
  */
-define('PROFILE_PUBLIC_LISTINGS', 3);
+if (!defined('PROFILE_PUBLIC_LISTINGS'))
+  define('PROFILE_PUBLIC_LISTINGS', 3);
 
 /**
  * Hidden profile field, only accessible by administrators, modules and themes.
  */
-define('PROFILE_HIDDEN', 4);
+if (!defined('PROFILE_HIDDEN'))
+  define('PROFILE_HIDDEN', 4);
 
 /**
  * Implementation of hook_help().
Index: modules/search/search.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.admin.inc,v
retrieving revision 1.6
diff -u -p -r1.6 search.admin.inc
--- modules/search/search.admin.inc	16 Jul 2008 21:59:27 -0000	1.6
+++ modules/search/search.admin.inc	13 Nov 2008 13:11:03 -0000
@@ -37,12 +37,10 @@ function search_admin_settings() {
   // Collect some stats
   $remaining = 0;
   $total = 0;
-  foreach (module_list() as $module) {
-    if (module_hook($module, 'search')) {
-      $status = module_invoke($module, 'search', 'status');
-      $remaining += $status['remaining'];
-      $total += $status['total'];
-    }
+  foreach (module_implements('search') as $module) {
+    $status = module_invoke($module, 'search', 'status');
+    $remaining += $status['remaining'];
+    $total += $status['total'];
   }
   $count = format_plural($remaining, 'There is 1 item left to index.', 'There are @count items left to index.');
   $percentage = ((int)min(100, 100 * ($total - $remaining) / max(1, $total))) . '%';
Index: modules/search/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.module,v
retrieving revision 1.274
diff -u -p -r1.274 search.module
--- modules/search/search.module	11 Nov 2008 16:49:38 -0000	1.274
+++ modules/search/search.module	13 Nov 2008 13:11:03 -0000
@@ -277,7 +277,7 @@ function search_cron() {
   register_shutdown_function('search_update_totals');
 
   // Update word index
-  foreach (module_list() as $module) {
+  foreach (module_implements('update_index') as $module) {
     module_invoke($module, 'update_index');
   }
 }
Index: modules/search/search.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/search/search.pages.inc,v
retrieving revision 1.5
diff -u -p -r1.5 search.pages.inc
--- modules/search/search.pages.inc	14 Apr 2008 17:48:41 -0000	1.5
+++ modules/search/search.pages.inc	13 Nov 2008 13:11:03 -0000
@@ -20,8 +20,10 @@ function search_view($type = 'node') {
       // switching tabs. This is why we drupal_goto to it from the parent instead.
       drupal_goto('search/node');
     }
-
-    $keys = search_get_keys();
+    
+    if (drupal_function_exists('search_get_keys')) {
+      $keys = search_get_keys();
+    }
     // Only perform search if there is non-whitespace search term:
     $results = '';
     if (trim($keys)) {
Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.37
diff -u -p -r1.37 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	13 Nov 2008 08:13:56 -0000	1.37
+++ modules/taxonomy/taxonomy.admin.inc	13 Nov 2008 13:11:03 -0000
@@ -14,7 +14,7 @@
  * @see theme_taxonomy_overview_vocabularies()
  */
 function taxonomy_overview_vocabularies() {
-  $vocabularies = taxonomy_get_vocabularies();
+  $vocabularies = module_invoke('taxonomy', 'get_vocabularies');
   $form = array('#tree' => TRUE);
   foreach ($vocabularies as $vocabulary) {
     $types = array();
Index: modules/tracker/tracker.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker/tracker.pages.inc,v
retrieving revision 1.12
diff -u -p -r1.12 tracker.pages.inc
--- modules/tracker/tracker.pages.inc	26 Oct 2008 18:06:39 -0000	1.12
+++ modules/tracker/tracker.pages.inc	13 Nov 2008 13:11:03 -0000
@@ -21,7 +21,7 @@ function tracker_page($account = NULL, $
       // here and not in the menu definiton.
       drupal_set_title($account->name);
     }
-  // TODO: These queries are very expensive, see http://drupal.org/node/105639
+    // TODO: These queries are very expensive, see http://drupal.org/node/105639
     $sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_updated DESC';
     $sql = db_rewrite_sql($sql);
     $sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
@@ -43,7 +43,7 @@ function tracker_page($account = NULL, $
     if ($node->comment_count) {
       $comments = $node->comment_count;
 
-      if ($new = comment_num_new($node->nid)) {
+      if (drupal_function_exists('comment_num_new') && $new = comment_num_new($node->nid)) {
         $comments .= '<br />';
         $comments .= l(format_plural($new, '1 new', '@count new'), "node/$node->nid", array('query' => comment_new_page_count($node->comment_count, $new, $node), 'fragment' => 'new'));
       }
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.933
diff -u -p -r1.933 user.module
--- modules/user/user.module	11 Nov 2008 22:39:59 -0000	1.933
+++ modules/user/user.module	13 Nov 2008 13:11:04 -0000
@@ -23,11 +23,10 @@ define('EMAIL_MAX_LENGTH', 64);
  * be passed by reference.
  */
 function user_module_invoke($type, &$array, &$user, $category = NULL) {
-  foreach (module_list() as $module) {
-    $function = $module . '_user_' . $type;
-    if (function_exists($function)) {
-      $function($array, $user, $category);
-    }
+  $hook = 'user_' . $type;
+  foreach (module_implements($hook) as $module) {
+    $function = $module . '_' . $hook;
+    $function($array, $user, $category);
   }
 }
 
@@ -1952,7 +1951,7 @@ function user_filters() {
   }
 
   $options = array();
-  foreach (module_list() as $module) {
+  foreach (module_implements('perm') as $module) {
     if ($permissions = module_invoke($module, 'perm')) {
       asort($permissions);
       foreach ($permissions as $permission => $description) {
@@ -2437,7 +2436,7 @@ function user_register_validate($form, &
  */
 function _user_forms(&$edit, $account, $category, $hook = 'form') {
   $groups = array();
-  foreach (module_list() as $module) {
+  foreach (module_implements('user_' . $hook) as $module) {
     if ($data = module_invoke($module, 'user_' . $hook, $edit, $account, $category)) {
       $groups = array_merge_recursive($data, $groups);
     }
Index: themes/garland/template.php
===================================================================
RCS file: /cvs/drupal/drupal/themes/garland/template.php,v
retrieving revision 1.19
diff -u -p -r1.19 template.php
--- themes/garland/template.php	25 Jun 2008 09:12:25 -0000	1.19
+++ themes/garland/template.php	13 Nov 2008 13:11:05 -0000
@@ -50,7 +50,7 @@ function garland_preprocess_page(&$vars)
   $vars['site_html'] = implode(' ', $site_fields);
 
   // Hook into color.module
-  if (module_exists('color')) {
+  if (drupal_function_exists('_color_page_alter')) {
     _color_page_alter($vars);
   }
 }
