function annotationcommand_adapter_refine_searchpaths

master annotationcommand_adapter.inc annotationcommand_adapter_refine_searchpaths($searchpath)

In some circumstances, Drush just does a deep search for any *.drush.inc file, so that it can find all commands, in enabled and disabled modules alike, for the purpose of displaying the help text for that command.

1 call to annotationcommand_adapter_refine_searchpaths()
annotationcommand_adapter_discover in includes/annotationcommand_adapter.inc
Search for annotation commands at the provided search path.

File

includes/annotationcommand_adapter.inc, line 788
annotationcommand_adapter.inc

Code

function annotationcommand_adapter_refine_searchpaths($searchpath) {
  $result =[];
  foreach ($searchpath as $path) {
    $max_depth = TRUE;
    $pattern = '/.*\.info$/';
    if (drush_drupal_major_version() > 7) {
      $pattern = '/.*\.info.yml$/';
    }
    $locations = drush_scan_directory($path, $pattern, ['.' '..'], false, $max_depth);

    // Search for any directory that might be a module or theme (contains
    // a *.info or a *.info.yml file)
    foreach ($locations as $key => $info) {
      $result[dirname($key)] = true;
    }
  }
  return array_keys($result);
}