summaryrefslogtreecommitdiff
path: root/modules/update
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2011-09-10 10:18:56 -0400
committerDries Buytaert <dries@buytaert.net>2011-09-10 10:18:56 -0400
commitfb804e29025eb170fa52c1907265144586a2022e (patch)
tree063e968204d5ebf8784b41b2f8d775476ad22216 /modules/update
parent98616ace539fbd613ddbd435e91357232963f424 (diff)
downloadbrdo-fb804e29025eb170fa52c1907265144586a2022e.tar.gz
brdo-fb804e29025eb170fa52c1907265144586a2022e.tar.bz2
- Patch #565288 by bfroehle, anarcat, p.brouwers, aspilicious: cannot install Drupal when Drupal.org is 503 (at Drupalcon!).
Diffstat (limited to 'modules/update')
-rw-r--r--modules/update/tests/update_test.module14
-rw-r--r--modules/update/update.fetch.inc2
-rw-r--r--modules/update/update.test14
3 files changed, 27 insertions, 3 deletions
diff --git a/modules/update/tests/update_test.module b/modules/update/tests/update_test.module
index 4e32d336a..4acb6ef83 100644
--- a/modules/update/tests/update_test.module
+++ b/modules/update/tests/update_test.module
@@ -12,6 +12,12 @@ function update_test_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
+ $items['503-error'] = array(
+ 'title' => t('503 Service unavailable'),
+ 'page callback' => 'update_callback_service_unavailable',
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
return $items;
}
@@ -148,3 +154,11 @@ class UpdateTestFileTransfer {
return $form;
}
}
+
+/**
+ * Return an Error 503 (Service unavailable) page.
+ */
+function update_callback_service_unavailable() {
+ drupal_add_http_header('Status', '503 Service unavailable');
+ print "503 Service Temporarily Unavailable";
+}
diff --git a/modules/update/update.fetch.inc b/modules/update/update.fetch.inc
index ff69cbb11..7ac0dbefb 100644
--- a/modules/update/update.fetch.inc
+++ b/modules/update/update.fetch.inc
@@ -143,7 +143,7 @@ function _update_process_fetch_task($project) {
if (empty($fail[$fetch_url_base]) || $fail[$fetch_url_base] < $max_fetch_attempts) {
$xml = drupal_http_request($url);
- if (isset($xml->data)) {
+ if (!isset($xml->error) && isset($xml->data)) {
$data = $xml->data;
}
}
diff --git a/modules/update/update.test b/modules/update/update.test
index 997650d73..c0f471a0a 100644
--- a/modules/update/update.test
+++ b/modules/update/update.test
@@ -32,9 +32,9 @@ class UpdateTestHelper extends DrupalWebTestCase {
*
* @see update_test_mock_page()
*/
- protected function refreshUpdateStatus($xml_map) {
+ protected function refreshUpdateStatus($xml_map, $url = 'update-test') {
// Tell update module to fetch from the URL provided by update_test module.
- variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE)));
+ variable_set('update_fetch_url', url($url, array('absolute' => TRUE)));
// Save the map for update_test_mock_page() to use.
variable_set('update_test_xml_map', $xml_map);
// Manually check the update status.
@@ -215,6 +215,16 @@ class UpdateCoreTestCase extends UpdateTestHelper {
$this->assertNoText(t('There is a security update available for your version of Drupal.'));
}
+ /**
+ * Tests the update module when the update server returns 503 (Service unavailable) errors.
+ */
+ function testServiceUnavailable() {
+ $this->refreshUpdateStatus(array(), '503-error');
+ // Ensure that no "Warning: SimpleXMLElement..." parse errors are found.
+ $this->assertNoText('SimpleXMLElement');
+ $this->assertUniqueText(t('Failed to get available update data for one project.'));
+ }
+
protected function setSystemInfo7_0() {
$setting = array(
'#all' => array(