summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.install8
-rw-r--r--modules/system/system.module35
2 files changed, 43 insertions, 0 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index c50f01770..e2fdf6382 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -241,6 +241,14 @@ 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');
}
diff --git a/modules/system/system.module b/modules/system/system.module
index ff8f7a0ed..4328a38ba 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -445,6 +445,15 @@ function system_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
+ // Menu handler to test that drupal_http_request() works locally.
+ // @see system_check_http_request().
+ $items['admin/reports/request-test'] = array(
+ 'title' => 'Request test',
+ 'page callback' => 'printf',
+ 'page arguments' => array('request test'),
+ 'access callback' => TRUE,
+ 'type' => MENU_CALLBACK,
+ );
// Reports:
$items['admin/reports'] = array(
@@ -1812,6 +1821,32 @@ function _system_zonelist() {
}
/**
+ * Checks whether the server is capable of issuing HTTP requests.
+ *
+ * The function sets the drupal_http_request_fail system variable to TRUE if
+ * drupal_http_request() does not work and then the system status report page
+ * will contain an error.
+ *
+ * @return
+ * Whether the admin/reports/request-test page can be requested via HTTP
+ * and contains the same output as if called via the menu system.
+ */
+function system_check_http_request() {
+ // Check whether we can do any request at all. First get the results for
+ // a very simple page which has access TRUE set via the menu system. Then,
+ // try to drupal_http_request() the same page and compare.
+ ob_start();
+ $path = 'admin/reports/request-test';
+ menu_execute_active_handler($path);
+ $nothing = ob_get_contents();
+ ob_end_clean();
+ $result = drupal_http_request(url($path, array('absolute' => TRUE)));
+ $works = isset($result->data) && $result->data == $nothing;
+ variable_set('drupal_http_request_fails', !$works);
+ return $works;
+}
+
+/**
* Format the Powered by Drupal text.
*
* @ingroup themeable