summaryrefslogtreecommitdiff
path: root/modules/update
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-29 07:08:38 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-29 07:08:38 +0000
commitb1dc42eb928a03ce98a1971440a6c97feb22cf56 (patch)
tree6fc2723720715a0c21b407062e953732127995c0 /modules/update
parent58dd4caa9848a83079bf0789b32874281b4d1480 (diff)
downloadbrdo-b1dc42eb928a03ce98a1971440a6c97feb22cf56.tar.gz
brdo-b1dc42eb928a03ce98a1971440a6c97feb22cf56.tar.bz2
#605292 by dww: Work-around BatchAPI's inability to propagate failure in update manager.
Diffstat (limited to 'modules/update')
-rw-r--r--modules/update/update.manager.inc30
1 files changed, 16 insertions, 14 deletions
diff --git a/modules/update/update.manager.inc b/modules/update/update.manager.inc
index 1790e4176..26ed4e8f9 100644
--- a/modules/update/update.manager.inc
+++ b/modules/update/update.manager.inc
@@ -326,14 +326,21 @@ function update_manager_update_form_submit($form, &$form_state) {
* Batch callback invoked when the download batch is completed.
*/
function update_manager_download_batch_finished($success, $results) {
- if ($success) {
- $_SESSION['update_manager_update_projects'] = $results;
+ if (!empty($results['errors'])) {
+ $error_list = array(
+ 'title' => t('Downloading updates failed:'),
+ 'items' => $results['errors'],
+ );
+ drupal_set_message(theme('item_list', $error_list), 'error');
+ }
+ elseif ($success) {
+ $_SESSION['update_manager_update_projects'] = $results['projects'];
drupal_goto('admin/update/confirm');
}
else {
- foreach($results as $project => $message) {
- drupal_set_message($message, 'error');
- }
+ // Ideally we're catching all Exceptions, so they should never see this,
+ // but just in case, we have to tell them something.
+ drupal_set_message(t('Fatal error trying to download.'), 'error');
}
}
@@ -758,17 +765,13 @@ function update_manager_batch_project_get($project, $url, &$context) {
if (!isset($context['sandbox']['started'])) {
$context['sandbox']['started'] = TRUE;
$context['message'] = t('Downloading %project', array('%project' => $project));
- $context['success'] = TRUE;
$context['finished'] = 0;
return;
}
- // Assume failure until we make it to the bottom and succeed.
- $context['success'] = FALSE;
-
// Actually try to download the file.
if (!($local_cache = update_manager_file_get($url))) {
- $context['results'][$project] = t('Failed to download %project from %url', array('%project' => $project, '%url' => $url));
+ $context['results']['errors'][$project] = t('Failed to download %project from %url', array('%project' => $project, '%url' => $url));
return;
}
@@ -778,7 +781,7 @@ function update_manager_batch_project_get($project, $url, &$context) {
update_manager_archive_extract($local_cache, $extract_directory);
}
catch (Exception $e) {
- $context['results'][$project] = $e->getMessage();
+ $context['results']['errors'][$project] = $e->getMessage();
return;
}
@@ -787,13 +790,12 @@ function update_manager_batch_project_get($project, $url, &$context) {
update_manager_archive_verify($project, $local_cache, $extract_directory);
}
catch (Exception $e) {
- $context['results'][$project] = $e->getMessage();
+ $context['results']['errors'][$project] = $e->getMessage();
return;
}
// Yay, success.
- $context['success'] = TRUE;
- $context['results'][$project] = $url;
+ $context['results']['projects'][$project] = $url;
$context['finished'] = 1;
}