Commit f40a6931 authored by Dries's avatar Dries
Browse files

- Patch #565288 by bfroehle, anarcat, p.brouwers, aspilicious: cannot install...

- Patch #565288 by bfroehle, anarcat, p.brouwers, aspilicious: cannot install Drupal when Drupal.org is 503 (at Drupalcon!).
parent 94b0b58b
......@@ -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 @@ public function getSettingsForm() {
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";
}
......@@ -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;
}
}
......
......@@ -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(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment