Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.206
diff -u -p -r1.206 bootstrap.inc
--- includes/bootstrap.inc	10 Jan 2008 22:47:17 -0000	1.206
+++ includes/bootstrap.inc	7 Mar 2008 18:03:12 -0000
@@ -218,6 +218,19 @@ function timer_stop($name) {
  *
  * 13. $confdir/default
  *
+ * If a file named sites.php is present in the $confdir, it will be loaded
+ * prior to scanning for directories.  It should define an associative array
+ * named $sites, which maps domains to directories.  For example:
+ *
+ * $sites = array(
+ *   'example.com' => 'otherexample.com'
+ * );
+ *
+ * The above array will cause Drupal to look for a directory named
+ * "otherexample.com" whenever it would otherwise look for "example.com".
+ * That is useful on development servers, where the domain name may not be
+ * the same as the domain of the live server.
+ *
  * @param $require_settings
  *   Only configuration directories with an existing settings.php file
  *   will be recognized. Defaults to TRUE. During initial installation,
@@ -229,27 +242,35 @@ function timer_stop($name) {
  * @return
  *   The path of the matching directory.
  */
-function conf_path($require_settings = TRUE, $reset = FALSE) {
-  static $conf = '';
-
-  if ($conf && !$reset) {
-    return $conf;
-  }
-
-  $confdir = 'sites';
-  $uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
-  $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
-  for ($i = count($uri) - 1; $i > 0; $i--) {
-    for ($j = count($server); $j > 0; $j--) {
-      $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
-      if (file_exists("$confdir/$dir/settings.php") || (!$require_settings && file_exists("$confdir/$dir"))) {
-        $conf = "$confdir/$dir";
-        return $conf;
-      }
-    }
-  }
-  $conf = "$confdir/default";
-  return $conf;
+function conf_path() {
+  static $conf = '';  if ($conf) {
+    return $conf;
+  }
+
+  $confdir = 'sites';
+
+  $sites = array();
+  if (file_exists($confdir .'/sites.php')) {
+    // This will overwrite $sites with the desired mappings.
+    include_once($confdir .'/sites.php');
+  }
+
+  $uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
+  $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
+  for ($i = count($uri) - 1; $i > 0; $i--) {
+    for ($j = count($server); $j > 0; $j--) {
+      $dir = implode('.', array_slice($server, -$j)) . implode('.', array_slice($uri, 0, $i));
+      if (isset($sites[$dir]) && file_exists("$confdir/{$sites[$dir]}")) {
+        $dir = $sites[$dir];
+      }
+      if (file_exists("$confdir/$dir/settings.php")) {
+        $conf = "$confdir/$dir";
+        return $conf;
+      }
+    }
+  }
+  $conf = "$confdir/default";
+  return $conf;
 }
 
 /**
