function drush_get_projects

8.0.x drush_get_projects(&$extensions = NULL)
6.x drush_get_projects(&$extensions = NULL)
7.x drush_get_projects(&$extensions = NULL)
3.x drush_get_projects()
4.x drush_get_projects(&$extensions = NULL)
5.x drush_get_projects(&$extensions = NULL)
master drush_get_projects(&$extensions = NULL)

Obtain an array of installed projects off the extensions available.

A project is considered to be 'enabled' when any of its extensions is enabled. If any extension lacks project information and it is found that the extension was obtained from's cvs or git repositories, a new 'vcs' attribute will be set on the extension. Example: $extensions[name]->vcs = 'cvs';


array $extensions.: Array of extensions as returned by drush_get_extensions().

Return value

Array of installed projects with info of version, status and provided

  • extensions.

Related topics

2 calls to drush_get_projects()
drush_pm_updatecode in commands/pm/
Command callback. Displays update status info and allows to update installed projects. Pass specific projects as arguments, otherwise we update all that have candidate releases.
_drush_pm_get_releases_from_xml in commands/pm/
Obtain releases for a project's xml as returned by the update service.


commands/pm/, line 359
The drush Project Manager


function drush_get_projects(&$extensions = NULL) {
  if (is_null($extensions)) {
    $extensions = drush_get_extensions();
  $projects = array('drupal' => array('version' => VERSION));
  foreach ($extensions as $extension) {
    // The project name is not available in this cases:
    // 1. the extension is part of drupal core.
    // 2. the project was checked out from CVS/git and cvs_deploy/git_deploy
    // is not installed.
    // 3. it is not a project hosted in
    if (empty($extension->info['project'])) {
      if (isset($extension->info['version']) && ($extension->info['version'] == VERSION)) {
        $project = 'drupal';
      else {
        if (is_dir(dirname($extension->filename) . '/CVS') && (!module_exists('cvs_deploy'))) {
          $extension->vcs = 'cvs';
          drush_log(dt('Extension !extension is fetched from cvs. Ignoring.', array('!extension' => $extension->name)), 'debug');
        elseif (is_dir(dirname($extension->filename) . '/.git') && (!module_exists('git_deploy'))) {
          $extension->vcs = 'git';
          drush_log(dt('Extension !extension is fetched from git. Ignoring.', array('!extension' => $extension->name)), 'debug');
    else {
      $project = $extension->info['project'];
    // Create/update the project in $projects with the project data.
    if (!isset($projects[$project])) {
      $projects[$project] = array(
        'type' => $extension->type,
        'version' => $extension->info['version'],
        'status' => $extension->status,
        'extensions' => array(),
      if (isset($extension->info['project status url'])) {
        $projects[$project]['status url'] = $extension->info['project status url'];
    elseif ($extension->status != 0) {
      $projects[$project]['status'] = $extension->status;
    $projects[$project]['extensions'][] = $extension->name;

  return $projects;