From b50f35a12d77c1b574de5adf98d40f00e59ab1f5 Mon Sep 17 00:00:00 2001
From: Damien McKenna <damien@mc-kenna.com>
Date: Mon, 14 Mar 2011 21:14:48 -0500
Subject: [PATCH] Issue #1002658 by jonhattan, DamienMcKenna: reworked project status requests so work around a Drupal core limitation.

---
 commands/pm/update_info/drupal_7.inc |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/commands/pm/update_info/drupal_7.inc b/commands/pm/update_info/drupal_7.inc
index c675496..480701d 100644
--- a/commands/pm/update_info/drupal_7.inc
+++ b/commands/pm/update_info/drupal_7.inc
@@ -50,20 +50,27 @@ function _pm_refresh() {
 /**
  * Get update information for all installed projects.
  *
+ * @see update_manual_status().
+ *
  * @return An array containing remote and local versions for all installed projects
  */
 function _pm_get_update_info($projects = NULL) {
-  // We force a refresh if the cache is not available.
-  if (!cache_get('update_available_releases', 'cache_update')) {
-    _pm_refresh();
-  }
+  _pm_refresh();
 
-  $info = update_get_available(TRUE);
+  $batch = array(
+    'operations' => array(
+      array('update_fetch_data_batch', array()),
+    ),
+    'finished' => 'update_fetch_data_finished',
+    'title' => t('Checking available update data'),
+    'progress_message' => t('Trying to check available update data ...'),
+    'error_message' => t('Error checking available update data.'),
+    'file' => drupal_get_path('module', 'update') . '/update.fetch.inc',
+  );
+  batch_set($batch);
+  drush_backend_batch_process();
 
-  // Force to invalidate some update_status caches that are only cleared
-  // when visiting update status report page.
-  _update_cache_clear('update_project_data');
-  _update_cache_clear('update_project_projects'); 
+  $info = update_get_available();
   $data = update_calculate_project_data($info);
   foreach ($data as $project_name => $project) {
     if (in_array($project['project_type'], array('module-disabled', 'theme-disabled'))) {
-- 
1.7.3.5

