? includes/database/install.inc
? sites/all/modules/cvs
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.32
diff -u -p -r1.32 path.inc
--- includes/path.inc	4 Jan 2009 20:04:32 -0000	1.32
+++ includes/path.inc	12 Feb 2009 19:40:37 -0000
@@ -52,7 +52,7 @@ function drupal_lookup_path($action, $pa
 
   // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
   if (!isset($count)) {
-    $count = db_query('SELECT COUNT(pid) FROM {url_alias}')->fetchField();
+    $count = module_exists('path') ? 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.306
diff -u -p -r1.306 system.install
--- modules/system/system.install	3 Feb 2009 12:30:14 -0000	1.306
+++ modules/system/system.install	12 Feb 2009 19:40:43 -0000
@@ -1221,46 +1221,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_language' => array('src', 'language'),
-    ),
-  );
-
   return $schema;
 }
 
@@ -3202,17 +3162,6 @@ function system_update_7017() {
 }
 
 /**
- * Replace src index on the {url_alias} table with src, language.
- */
-function system_update_7018() {
-  $ret = array();
-  db_add_index($ret, 'url_alias', 'src_language', array('src', 'language'));
-  db_drop_index($ret, 'url_alias', 'src');
-
-  return $ret;
-}
-
-/**
  * @} 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 modules/path/path.install
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/path/path.install	12 Feb 2009 19:42:23 -0000
@@ -0,0 +1,79 @@
+<?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_language' => array('src', 'language'),
+    ),
+  );
+
+  return $schema;
+}
+
+/**
+ * Implementation of hook_install().
+ */
+function path_install() {
+  // Check if the path tables exist first before installing since previous to
+  // Drupal 7, they was installed automatically with the system module.
+  if (!db_table_exists('url_alias')) {
+    drupal_install_schema('path');
+  }
+}
+
+/**
+ * Implementation of hook_uninstall().
+ */
+function path_uninstall() {
+  drupal_uninstall_schema('path');
+}
+
+/**
+ * Replace src index on the {url_alias} table with src, language.
+ */
+function path_update_7000() {
+  $ret = array();
+  db_add_index($ret, 'url_alias', 'src_language', array('src', 'language'));
+  db_drop_index($ret, 'url_alias', 'src');
+
+  return $ret;
+}
+
