Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.95 diff -u -F^f -r1.95 bootstrap.inc --- includes/bootstrap.inc 21 Apr 2006 06:39:00 -0000 1.95 +++ includes/bootstrap.inc 22 Apr 2006 12:35:28 -0000 @@ -116,11 +116,24 @@ function conf_path() { } $confdir = 'sites'; - $uri = explode('/', $_SERVER['PHP_SELF']); - $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 (PHP_SAPI != 'cli') { + $uri = explode('/', $_SERVER['PHP_SELF']); + $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")) { + $conf = "$confdir/$dir"; + return $conf; + } + } + } + } + else { + array_shift($_SERVER['argv']); // Remove the program name from arguments. + if (($pos = array_search('--site', $_SERVER['argv'])) !== false) { + $dir = $_SERVER['argv'][$pos+1]; + unset($_SERVER['argv'][$pos], $_SERVER['argv'][$pos+1]); if (file_exists("$confdir/$dir/settings.php")) { $conf = "$confdir/$dir"; return $conf; Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.3 diff -u -F^f -r1.3 path.inc --- includes/path.inc 24 Jan 2006 08:18:26 -0000 1.3 +++ includes/path.inc 22 Apr 2006 12:35:28 -0000 @@ -18,7 +18,18 @@ function drupal_init_path() { $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); } else { - $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); + if (PHP_SAPI != 'cli') { + $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); + } + else { + $_REQUEST['q'] = array_shift($_SERVER['argv']); + if (!empty($_REQUEST['q'])) { + $_GET['q'] = drupal_get_normal_path(trim($_REQUEST['q'], '/')); + } + else { + $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); + } + } } }