예제 #1
0
/**
 * Exhaustive depth-first search to try and locate the Drupal root directory.
 * This makes it possible to run drush from a subdirectory of the drupal root.
 * 
 * @param $path
 *   The path the start the search from.
 */
function _drush_locate_root($path)
{
    // Check the current path.
    if (file_exists($path . '/' . DRUSH_DRUPAL_BOOTSTRAP)) {
        return $path;
    }
    // Move up dir by dir and check each.
    while ($path = _drush_locate_root_moveup($path)) {
        if (file_exists($path . '/' . DRUSH_DRUPAL_BOOTSTRAP)) {
            return $path;
        }
    }
    return FALSE;
}
예제 #2
0
/**
 * Exhaustive depth-first search to try and locate the Drupal root directory.
 * This makes it possible to run drush from a subdirectory of the drupal root.
 */
function _drush_locate_root()
{
    $path = getcwd();
    // Convert windows paths.
    $path = drush_convert_path($path);
    // Check the current path.
    if (file_exists($path . '/' . DRUSH_DRUPAL_BOOTSTRAP)) {
        return $path;
    }
    // Move up dir by dir and check each.
    while ($path = _drush_locate_root_moveup($path)) {
        if (file_exists($path . '/' . DRUSH_DRUPAL_BOOTSTRAP)) {
            return $path;
        }
    }
    return FALSE;
}