function pm_get_project_path

3.x pm.drush.inc pm_get_project_path($projects, $lookup)

We need to set the project path by looking at the module location. Ideally, update.module would do this for us.

TODO: Improve logic so this works even if your project directory is not named the same as the project name.

4 calls to pm_get_project_path()
drush_upgrade_site_upgrade in commands/core/upgrade.drush.inc
A drush command callback.
_pm_get_update_info in commands/pm/update_info/drupal_6.inc
Get update information for all installed projects.
_pm_get_update_info in commands/pm/update_info/drupal_7.inc
Get update information for all installed projects.
_pm_get_update_info in commands/pm/update_info/drupal_5.inc
Get update information for all installed projects.

File

commands/pm/pm.drush.inc, line 788
The drush Package Manager

Code

function pm_get_project_path($projects, $lookup) {
  foreach ($projects as $name => $project) {
    if (!isset($project['path']) && $name != 'drupal') {
      // looks for an enabled module.
      foreach ($project[$lookup] as $filename => $title) {
        if ($path = drupal_get_path($project['project_type'], $filename)) {
          continue;
        }
      }
      // As some modules are not located in their project's root directory
      // but in a subdirectory (e.g. all the ecommerce modules), we take the module's
      // info file's path, and then move up until we are at a directory with the
      // project's name.
      $parts = explode('/', $path);
      $i = count($parts) - 1;
      $stop = array_search($name, $parts);
      while ($i > $stop) {
        unset($parts[$i]);
        $i--;
      }
      $projects[$name]['path'] = implode('/', $parts);
    }
  }
  return $projects;
}