$project) { if (empty($available[$key])) { update_create_fetch_task($project); continue; } if ($project['info']['_info_file_ctime'] > $available[$key]['last_fetch']) { $available[$key]['fetch_status'] = UPDATE_FETCH_PENDING; } if (empty($available[$key]['releases'])) { $available[$key]['fetch_status'] = UPDATE_FETCH_PENDING; } if (!empty($available[$key]['fetch_status']) && $available[$key]['fetch_status'] == UPDATE_FETCH_PENDING) { update_create_fetch_task($project); } } // Set a batch to process all pending tasks. $batch = array( 'operations' => array( array('update_fetch_data_batch', array()), ), 'finished' => 'update_fetch_data_finished', 'file' => drupal_get_path('module', 'update') . '/update.fetch.inc', ); batch_set($batch); drush_backend_batch_process(); // Calculate update status data. $available = _update_get_cached_available_releases(); $data = update_calculate_project_data($available); foreach ($data as $project_name => $project) { // Discard custom projects. if ($project['status'] == UPDATE_UNKNOWN) { unset($data[$project_name]); continue; } // Allow to update disabled projects. if (in_array($project['project_type'], array('module-disabled', 'theme-disabled'))) { $data[$project_name]['project_type'] = substr($project['project_type'], 0, strpos($project['project_type'], '-')); } // Set 'includes' key to all extensions. By default it only contain enabled // extensions and _pm_get_project_path() needs all of them. $data[$project_name]['includes'] = drupal_map_assoc($projects[$project_name]['extensions']); // Store all releases, not just the ones selected by update.module. $data[$project_name]['releases'] = $available[$project_name]['releases']; } $data = _pm_get_project_path($data, 'includes'); return $data; } function pm_get_project_info($projects) { $data = array(); include_once drupal_get_path('module', 'update') .'/update.fetch.inc'; foreach ($projects as $project_name => $project) { $url = UPDATE_DEFAULT_URL. "/$project_name/". drush_drupal_major_version() . '.x'; $xml = drupal_http_request($url); if (isset($xml->error)) { drush_set_error(dt( 'HTTP Request to @request has failed. @error', array('@request' => $xml->request, '@error' => $xml->error) )); } elseif (!$info = update_parse_xml($xml->data)) { drush_set_error(dt( 'No release history found for @project_name', array('@project_name' => $project_name) )); } else { $data[$project_name] = $info; } } return $data; }