diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/aggregator/aggregator.fetcher.inc | 1 | ||||
-rw-r--r-- | modules/openid/openid.module | 8 | ||||
-rw-r--r-- | modules/system/system.install | 20 | ||||
-rw-r--r-- | modules/system/system.module | 10 | ||||
-rw-r--r-- | modules/update/update.fetch.inc | 1 |
5 files changed, 17 insertions, 23 deletions
diff --git a/modules/aggregator/aggregator.fetcher.inc b/modules/aggregator/aggregator.fetcher.inc index ac91a0dc1..026389815 100644 --- a/modules/aggregator/aggregator.fetcher.inc +++ b/modules/aggregator/aggregator.fetcher.inc @@ -76,6 +76,5 @@ function aggregator_aggregator_fetch($feed) { default: watchdog('aggregator', 'The feed from %site seems to be broken, due to "%error".', array('%site' => $feed->title, '%error' => $result->code . ' ' . $result->error), WATCHDOG_WARNING); drupal_set_message(t('The feed from %site seems to be broken, because of error "%error".', array('%site' => $feed->title, '%error' => $result->code . ' ' . $result->error))); - module_invoke('system', 'check_http_request'); } } diff --git a/modules/openid/openid.module b/modules/openid/openid.module index 26902fe9a..f7636ad29 100644 --- a/modules/openid/openid.module +++ b/modules/openid/openid.module @@ -316,9 +316,6 @@ function openid_discovery($claimed_id) { } } } - if (!$services) { - module_invoke('system', 'check_http_request'); - } return $services; } @@ -354,13 +351,11 @@ function openid_association($op_endpoint) { ); $assoc_result = drupal_http_request($op_endpoint, $assoc_options); if (isset($assoc_result->error)) { - module_invoke('system', 'check_http_request'); return FALSE; } $assoc_response = _openid_parse_message($assoc_result->data); if (isset($assoc_response['mode']) && $assoc_response['mode'] == 'error') { - module_invoke('system', 'check_http_request'); return FALSE; } @@ -529,8 +524,5 @@ function openid_verify_assertion($op_endpoint, $response) { } } } - if (!$valid) { - module_invoke('system', 'check_http_request'); - } return $valid; } diff --git a/modules/system/system.install b/modules/system/system.install index 5b73c4b87..7e3714aa9 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -256,8 +256,8 @@ function system_requirements($phase) { include_once DRUPAL_ROOT . '/includes/unicode.inc'; $requirements = array_merge($requirements, unicode_requirements()); - // Check for update status module. if ($phase == 'runtime') { + // Check for update status module. if (!module_exists('update')) { $requirements['update status'] = array( 'value' => $t('Not enabled'), @@ -269,16 +269,18 @@ function system_requirements($phase) { $requirements['update status'] = array( 'value' => $t('Enabled'), ); - if (variable_get('drupal_http_request_fails', FALSE)) { - $requirements['http requests'] = array( - 'title' => $t('HTTP request status'), - 'value' => $t('Fails'), - 'severity' => REQUIREMENT_ERROR, - 'description' => $t('Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services.'), - ); - } } $requirements['update status']['title'] = $t('Update notifications'); + + // Check that Drupal can issue HTTP requests. + if (variable_get('drupal_http_request_fails', TRUE) && !system_check_http_request()) { + $requirements['http requests'] = array( + 'title' => $t('HTTP request status'), + 'value' => $t('Fails'), + 'severity' => REQUIREMENT_ERROR, + 'description' => $t('Your system or network configuration does not allow Drupal to access web pages, resulting in reduced functionality. This could be due to your webserver configuration or PHP settings, and should be resolved in order to download information about available updates, fetch aggregator feeds, sign in via OpenID, or use other network-dependent services. If you are certain that Drupal can access web pages but you are still seeing this message, you may add <code>$conf[\'drupal_http_request_fails\'] = FALSE;</code> to the bottom of your settings.php file.'), + ); + } } return $requirements; diff --git a/modules/system/system.module b/modules/system/system.module index c62b43784..7d5e4e22a 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2177,12 +2177,14 @@ function system_time_zones($blank = NULL) { * will contain an error. * * @return - * Whether the www.example.com page can be requested via HTTP. + * TRUE if this installation can issue HTTP requests. */ function system_check_http_request() { - $result = drupal_http_request('http://www.example.com'); - // If the resulting page contains RFC 2606 then we got the page we wanted. - $works = isset($result->data) && preg_match('/RFC\s+2606/', $result->data); + // Try to get the content of the front page via drupal_http_request(). + $result = drupal_http_request(url('', array('absolute' => TRUE))); + // We only care that we get a http response - this means that Drupal + // can make a http request. + $works = isset($result->code) && ($result->code >= 100) && ($result->code < 600); variable_set('drupal_http_request_fails', !$works); return $works; } diff --git a/modules/update/update.fetch.inc b/modules/update/update.fetch.inc index 0ffb746d7..adae8c36c 100644 --- a/modules/update/update.fetch.inc +++ b/modules/update/update.fetch.inc @@ -56,7 +56,6 @@ function _update_refresh() { watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates')); } else { - module_invoke('system', 'check_http_request'); watchdog('update', 'Unable to fetch any information about available new releases and updates.', array(), WATCHDOG_ERROR, l(t('view'), 'admin/reports/updates')); } return $available; |