function DrupalBoot7::valid_root

8.0.x DrupalBoot7.php DrupalBoot7::valid_root($path)
7.x DrupalBoot7.php DrupalBoot7::valid_root($path)
master DrupalBoot7.php DrupalBoot7::valid_root($path)

This function determines if the specified path points to the root directory of a CMS that can be bootstrapped by the specific subclass that implements it.

These functions should be written such that one and only one class will return TRUE for any given $path.

Parameters

$path to a directory to test:

Return value

TRUE if $path is a valid root directory

Overrides DrupalBoot::valid_root

File

lib/Drush/Boot/DrupalBoot7.php, line 7

Namespace

Drush\Boot

Class

DrupalBoot7

Code

function valid_root($path) {
  if (!empty($path) && is_dir($path) && file_exists($path . '/index.php')) {
    // Drupal 7 root.
    // We check for the presence of 'modules/field/field.module' to differentiate this from a D6 site
    $candidate = 'includes/common.inc';
    if (file_exists($path . '/' . $candidate) && file_exists($path . '/misc/drupal.js') && file_exists($path . '/modules/field/field.module')) {
      return $candidate;
    }
  }
}