Greetings! I'm not entirely sure that this is a bug, but I ran into some problems installing Drush on D7 HEAD. I kept getting the following fatal error:

PHP Warning:  require_once(DRUPAL_ROOT/includes/cache.inc): failed to open stream: No such file or directory in /var/www/html/includes/bootstrap.inc on line 1009
PHP Fatal error:  require_once(): Failed opening required 'DRUPAL_ROOT/includes/cache.inc' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/includes/bootstrap.inc on line 1009

The only way I could fix the problem was to explicitly define DRUPAL_ROOT in drush.php:

--- drush.php       2008-08-28 05:16:57.000000000 -0400
+++ drush.php   2008-09-23 13:03:03.000000000 -0400
@@ -84,6 +84,7 @@ function drush_bootstrap($argc, $argv) {

   // If no root is defined, we try to guess from the current directory.
   define('DRUSH_DRUPAL_ROOT',  drush_get_option(array('r', 'root'), _drush_locate_root()));
+  define('DRUPAL_ROOT', DRUSH_DRUPAL_ROOT);

   // If the Drupal directory can't be found, and no -r option was specified,
   // or the path specified in -r does not point to a Drupal directory,

The current working directory was correct for the drupal root, but since D7 defines DRUPAL_ROOT in index.php, it wasn't getting set in the _drush_bootstrap_drupal() function.

Perhaps it's a bit premature to make note of this, but hopefully it helps :)

Kevin

Comments

kevin hankens’s picture

Title: Undefined DRUPAL_ROOT in bootstrap » Undefined DRUPAL_ROOT in Drush bootstrap

Added "Drush" in title for clarity

moshe weitzman’s picture

Trying to get this addressed in core - http://drupal.org/node/259623#comment-1026200

kevin hankens’s picture

Status: Active » Closed (duplicate)

Oops, missed that one, marking as duplicate :)

I agree, it seems like it should definitely be handled in core.

BTW, do you need any help with updating the SQL functions to use the new database variables?

moshe weitzman’s picture

Yes - help please. All good idea welcome, in all parts of drush.

moshe weitzman’s picture

I committed this just to keep the module working. Thanks.