You are here

function _dmu_get_directory in Drupal 7 to 8/9 Module Upgrader 8

Determines the path to a module.

Parameters

string $module: The module's machine name.

Return value

string|null Directories.

3 calls to _dmu_get_directory()
_dmu_build_target in ./drupalmoduleupgrader.drush.inc
Build our target.
_dmu_ensure_directory in ./drupalmoduleupgrader.drush.inc
Checks possible locations of a target module.
_dmu_ensure_info_present in ./drupalmoduleupgrader.drush.inc
Determines if user is re running drupal module upgrade.

File

./drupalmoduleupgrader.drush.inc, line 155
Declarations for Drush.

Code

function _dmu_get_directory($module) {
  if ($path = drush_get_option('path', NULL)) {
    return $path;
  }
  else {
    $search_directories = [
      DRUPAL_ROOT . '/modules/' . $module,
      __DIR__ . '/' . $module,
    ];
    $directories = array_filter($search_directories, 'is_dir');
    if ($directories) {
      return reset($directories);
    }
  }
}