comparison modules/system/system.module @ 19:3edae6ecd6c6 6.9

Drupal 6.9
author Franck Deroche <franck@defr.org>
date Thu, 15 Jan 2009 10:15:56 +0100
parents 8e6257f3ae39
children
comparison
equal deleted inserted replaced
18:f5131a9cd9e5 19:3edae6ecd6c6
1 <?php 1 <?php
2 // $Id: system.module,v 1.585.2.26 2008/12/11 17:39:42 goba Exp $ 2 // $Id: system.module,v 1.585.2.30 2009/01/14 23:34:07 goba Exp $
3 3
4 /** 4 /**
5 * @file 5 * @file
6 * Configuration system that lets administrators modify the workings of the site. 6 * Configuration system that lets administrators modify the workings of the site.
7 */ 7 */
8 8
9 /** 9 /**
10 * The current system version. 10 * The current system version.
11 */ 11 */
12 define('VERSION', '6.8'); 12 define('VERSION', '6.9');
13 13
14 /** 14 /**
15 * Core API compatibility. 15 * Core API compatibility.
16 */ 16 */
17 define('DRUPAL_CORE_COMPATIBILITY', '6.x'); 17 define('DRUPAL_CORE_COMPATIBILITY', '6.x');
466 'page callback' => 'drupal_json', 466 'page callback' => 'drupal_json',
467 'page arguments' => array(array('status' => TRUE)), 467 'page arguments' => array(array('status' => TRUE)),
468 'access callback' => TRUE, 468 'access callback' => TRUE,
469 'type' => MENU_CALLBACK, 469 'type' => MENU_CALLBACK,
470 ); 470 );
471 // Menu handler to test that drupal_http_request() works locally.
472 // @see system_check_http_request()
473 $items['admin/reports/request-test'] = array(
474 'title' => 'Request test',
475 'page callback' => 'printf',
476 'page arguments' => array('request test'),
477 'access callback' => TRUE,
478 'type' => MENU_CALLBACK,
479 );
480 471
481 // Reports: 472 // Reports:
482 $items['admin/reports'] = array( 473 $items['admin/reports'] = array(
483 'title' => 'Reports', 474 'title' => 'Reports',
484 'description' => 'View reports from system logs and other status information.', 475 'description' => 'View reports from system logs and other status information.',
1868 * The function sets the drupal_http_request_fail system variable to TRUE if 1859 * The function sets the drupal_http_request_fail system variable to TRUE if
1869 * drupal_http_request() does not work and then the system status report page 1860 * drupal_http_request() does not work and then the system status report page
1870 * will contain an error. 1861 * will contain an error.
1871 * 1862 *
1872 * @return 1863 * @return
1873 * Whether the admin/reports/request-test page can be requested via HTTP 1864 * TRUE if this installation can issue HTTP requests.
1874 * and contains the same output as if called via the menu system.
1875 */ 1865 */
1876 function system_check_http_request() { 1866 function system_check_http_request() {
1877 // Check whether we can do any request at all. First get the results for 1867 // Try to get the content of the front page via drupal_http_request().
1878 // a very simple page which has access TRUE set via the menu system. Then, 1868 $result = drupal_http_request(url('', array('absolute' => TRUE)));
1879 // try to drupal_http_request() the same page and compare. 1869 // We only care that we get a http response - this means that Drupal
1880 ob_start(); 1870 // can make a http request.
1881 $path = 'admin/reports/request-test'; 1871 $works = isset($result->code) && ($result->code >= 100) && ($result->code < 600);
1882 menu_execute_active_handler($path);
1883 $nothing = ob_get_contents();
1884 ob_end_clean();
1885 $result = drupal_http_request(url($path, array('absolute' => TRUE)));
1886 $works = isset($result->data) && $result->data == $nothing;
1887 variable_set('drupal_http_request_fails', !$works); 1872 variable_set('drupal_http_request_fails', !$works);
1888 return $works; 1873 return $works;
1889 } 1874 }
1890 1875
1891 /** 1876 /**