function drush_valid_drupal_root

6.x drush_valid_drupal_root($path)
3.x drush_valid_drupal_root($path)
4.x drush_valid_drupal_root($path)
5.x drush_valid_drupal_root($path)

Checks whether given path qualifies as a Drupal root.


string: Path to check.

Return value

string The relative path to (varies by Drupal version), or FALSE if not a Drupal root.

4 calls to drush_valid_drupal_root()
drush_locate_root in includes/
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.
_drush_bootstrap_drupal_root_validate in includes/
_drush_find_local_sites_at_root in includes/
Return a list of all of the local sites at the specified drupal root.
_drush_sitealias_get_record in includes/
This is a continuation of drush_sitealias_get_record, above. It is not intended to be called directly.


includes/, line 383
Functions used by drush to query the environment and setting the current configuration.


function drush_valid_drupal_root($path) {
  if (!empty($path) && is_dir($path)) {
    $candidates = array('includes/', 'core/includes/');
    foreach ($candidates as $candidate) {
      if (file_exists($path . '/' . $candidate)) {
        return $candidate;
  return FALSE;