Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.28
diff -u -p -r1.28 path.inc
--- includes/path.inc	14 Oct 2008 11:01:08 -0000	1.28
+++ includes/path.inc	17 Nov 2008 03:49:52 -0000
@@ -46,13 +46,17 @@ function drupal_init_path() {
 function drupal_lookup_path($action, $path = '', $path_language = '') {
   global $language;
   // $map is an array with language keys, holding arrays of Drupal paths to alias relations
-  static $map = array(), $no_src = array(), $count;
+  static $map = array(), $no_src = array(), $count, $paths_enabled;
+
+  if (!isset($paths_enabled)) {
+    $paths_enabled = db_table_exists('url_alias');
+  }
 
   $path_language = $path_language ? $path_language : $language->language;
 
   // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
   if (!isset($count)) {
-    $count = db_result(db_query('SELECT COUNT(pid) FROM {url_alias}'));
+    $count = $paths_enabled ? db_query('SELECT COUNT(pid) FROM {url_alias}')->fetchField() : 0;
   }
 
   if ($action == 'wipe') {
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.280
diff -u -p -r1.280 system.install
--- modules/system/system.install	15 Nov 2008 13:01:10 -0000	1.280
+++ modules/system/system.install	17 Nov 2008 03:49:55 -0000
@@ -1247,46 +1247,6 @@ function system_schema() {
     ),
   );
 
-  $schema['url_alias'] = array(
-    'description' => 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.',
-    'fields' => array(
-      'pid' => array(
-        'description' => 'A unique path alias identifier.',
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE,
-      ),
-      'src' => array(
-        'description' => 'The Drupal path this alias is for; e.g. node/12.',
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'dst' => array(
-        'description' => 'The alias for this path; e.g. title-of-the-story.',
-        'type' => 'varchar',
-        'length' => 128,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-      'language' => array(
-        'description' => 'The language this alias is for; if blank, the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.',
-        'type' => 'varchar',
-        'length' => 12,
-        'not null' => TRUE,
-        'default' => '',
-      ),
-    ),
-    'unique keys' => array(
-      'dst_language' => array('dst', 'language'),
-    ),
-    'primary key' => array('pid'),
-    'indexes' => array(
-      'src' => array('src'),
-    ),
-  );
-
   return $schema;
 }
 
@@ -3100,4 +3060,3 @@ function system_update_7012() {
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
-
Index: modules/path/path.install
===================================================================
RCS file: modules/path/path.install
diff -N path.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/path/path.install	17 Nov 2008 03:50:06 -0000
@@ -0,0 +1,65 @@
+<?php
+// $Id$
+
+/**
+ * Implementation of hook_schema().
+ */
+function path_schema() {
+  $schema['url_alias'] = array(
+    'description' => 'A list of URL aliases for Drupal paths; a user may visit either the source or destination path.',
+    'fields' => array(
+      'pid' => array(
+        'description' => 'A unique path alias identifier.',
+        'type' => 'serial',
+        'unsigned' => TRUE,
+        'not null' => TRUE,
+      ),
+      'src' => array(
+        'description' => 'The Drupal path this alias is for; e.g. node/12.',
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'dst' => array(
+        'description' => 'The alias for this path; e.g. title-of-the-story.',
+        'type' => 'varchar',
+        'length' => 128,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+      'language' => array(
+        'description' => 'The language this alias is for; if blank, the alias will be used for unknown languages. Each Drupal path can have an alias for each supported language.',
+        'type' => 'varchar',
+        'length' => 12,
+        'not null' => TRUE,
+        'default' => '',
+      ),
+    ),
+    'unique keys' => array(
+      'dst_language' => array('dst', 'language'),
+    ),
+    'primary key' => array('pid'),
+    'indexes' => array(
+      'src' => array('src'),
+    ),
+  );
+
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install().
+ */
+function path_install() {
+  if (!db_table_exists('url_alias')) {
+    drupal_install_schema('path');
+  }
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function path_uninstall() {
+  drupal_uninstall_schema('path');
+}
