Revision 3db2866c
Added by Andreas Kohlbecker almost 11 years ago
7.x/modules/cdm_dataportal/INSTALL.txt | ||
---|---|---|
1 |
Prerequisites: |
|
2 |
======================================================== |
|
3 |
|
|
4 |
Required php extensions: |
|
5 |
|
|
6 |
- CURL |
|
7 |
|
|
8 |
Required additional Drupal Modules: |
|
9 |
|
|
10 |
JQuery Update with manual update to jQuery 1.2.1 |
|
11 |
-------------------------------------------------------- |
|
12 |
http://drupal.org/project/jquery_update |
|
13 |
|
|
14 |
release 5.x-1.0 updates to jQuery version 1.1.2 |
|
15 |
|
|
16 |
IMPORTANT: |
|
17 |
|
|
18 |
cdm_dataportl requires jQuery version 1.2.1 |
|
19 |
The contributed Drupal module 'jquery_update' however updates only to version 1.1.2, |
|
20 |
thus a manual update as described in http://drupal.org/node/196140 is nessecary. |
|
21 |
|
|
22 |
I addition you must edit compat-1.0.js: replace lines 24 - 26 by: |
|
23 |
|
|
24 |
/* |
|
25 |
* a.kohlbecker: unload is still a valid event type and must not be replaced! |
|
26 |
* compat-1.0.js breaks plugins wich are using this event e.g. thickbox |
|
27 |
* => thus I removed load from var e. |
|
28 |
*/ |
|
29 |
var e = ("blur,focus, resize,scroll,unload,click,dblclick," + |
|
30 |
"mousedown,mouseup,mousemove,mouseover,mouseout,change,reset,select," + |
|
31 |
"submit,keydown,keypress,keyup,error").split(","); |
|
32 |
|
|
33 |
|
|
34 |
Installation procedure: |
|
35 |
======================================================== |
|
36 |
|
|
37 |
- Install the module by extracting it into the folder |
|
38 |
sites/all/modules or into a site specific module folder |
|
39 |
- Enable the module cdm_dataportal in the admin section. |
|
40 |
- Go to admin/settings/cdm_dataportal and configure the |
|
41 |
cdm web service connection according to your needs. |
|
1 |
For installation instructions please refer to http://wp5.e-taxonomy.eu/node/7 |
7.x/modules/cdm_dataportal/cdm_api/cdm_api.install | ||
---|---|---|
103 | 103 |
db_create_table('cache_cdm_ws', $schema['cache_cdm_ws']); |
104 | 104 |
} |
105 | 105 |
|
106 |
/* |
|
107 |
Comment @WA: fix is obsolete in Drupal 7. |
|
108 |
function _get_sql_fix_watchdog() { |
|
109 |
return "ALTER TABLE {watchdog} CHANGE referer referer TEXT NOT NULL ;"; |
|
110 |
} |
|
111 |
*/ |
|
112 | 106 |
|
113 | 107 |
/** |
114 | 108 |
* Implements hook_requirements(). |
... | ... | |
118 | 112 |
* of the module if a critical requirement is missing. |
119 | 113 |
*/ |
120 | 114 |
function cdm_api_requirements() { |
121 |
// t() Is not yet available in installation phase, so we use get_t instead. |
|
122 |
$t = get_t(); |
|
123 | 115 |
$requirements['cdm_api'] = array( |
124 |
'title' => $t('CDM API'),
|
|
116 |
'title' => 'CDM API'
|
|
125 | 117 |
); |
126 | 118 |
|
127 |
if (function_exists('curl_init')) { |
|
128 |
// Description below title is not yet in use. |
|
129 |
$requirements['cdm_api']['description'] = ''; |
|
130 |
$requirements['cdm_api']['value'] = $t(' |
|
131 |
CURL php extension is available and will be used by the CDM API. |
|
132 |
HTTP requests thus will be up to 20x faster.' |
|
133 |
); |
|
134 |
} |
|
135 |
else { |
|
136 |
$requirements['cdm_api']['value'] = $t('CURL php extension is missing. If |
|
137 |
CURL lib is installed HTTP requests will be up to 20x faster.'); |
|
138 |
} |
|
139 |
|
|
140 |
// FIXME: once _get_content_fsockopen is implemented change severity to |
|
141 |
// REQUIREMENT_WARNING. |
|
142 |
$requirements['cdm_api']['severity'] = (function_exists('curl_init') ? REQUIREMENT_OK : REQUIREMENT_INFO); |
|
143 |
|
|
144 | 119 |
return $requirements; |
145 | 120 |
} |
7.x/modules/cdm_dataportal/cdm_api/cdm_api.module | ||
---|---|---|
1565 | 1565 |
} |
1566 | 1566 |
|
1567 | 1567 |
if (empty($header) && _is_cdm_ws_uri($uri)) { |
1568 |
$header['Accept'] = (variable_get('cdm_webservice_type', 'json') == 'json' ? 'application/json' : 'text/xml');
|
|
1568 |
$header['Accept'] = 'application/json';
|
|
1569 | 1569 |
$header['Accept-Language'] = $acceptLanguage; |
1570 | 1570 |
$header['Accept-Charset'] = 'UTF-8'; |
1571 | 1571 |
} |
1572 | 1572 |
|
1573 |
if (FALSE && function_exists('curl_init')) { |
|
1574 |
// !!!!! CURL Disabled due to problems with following redirects |
|
1575 |
// (CURLOPT_FOLLOWLOCATION=1) and safe_mode = on |
|
1576 |
// Use the CURL lib if installed, it is supposed to be 20x faster. |
|
1577 |
return _http_request_using_curl($uri, $header, $method, $parameters); |
|
1578 |
} |
|
1579 |
else { |
|
1580 |
return _http_request_using_fsockopen($uri, $header, $method, $parameters); |
|
1581 |
} |
|
1582 |
} |
|
1583 |
|
|
1584 |
/** |
|
1585 |
* @todo Please document this function. |
|
1586 |
* @see http://drupal.org/node/1354 |
|
1587 |
*/ |
|
1588 |
function _http_request_using_fsockopen($uri, $header = array(), $method = 'GET') { |
|
1589 | 1573 |
$response = drupal_http_request($uri, array('headers' => $header, 'method' => $method, 'timeout' => CDM_HTTP_REQUEST_TIMEOUT)); |
1590 | 1574 |
if (isset($response->data)) { |
1591 | 1575 |
return $response->data; |
1592 | 1576 |
} |
1593 | 1577 |
} |
1594 | 1578 |
|
1595 |
/** |
|
1596 |
* Return string content from a remote file. |
|
1597 |
* |
|
1598 |
* @author Luiz Miguel Axcar <lmaxcar@yahoo.com.br> |
|
1599 |
* |
|
1600 |
* @param string $uri |
|
1601 |
* The url for which to return content. |
|
1602 |
* |
|
1603 |
* @return string |
|
1604 |
* The returned content. |
|
1605 |
*/ |
|
1606 |
function _http_request_using_curl($uri, $headers = array(), $method = "GET", $parameters = array()) { |
|
1607 |
$ch = curl_init(); |
|
1608 |
|
|
1609 |
curl_setopt($ch, CURLOPT_URL, $uri); |
|
1610 |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); |
|
1611 |
curl_setopt($ch, CURLOPT_MAXREDIRS, 5); |
|
1612 |
|
|
1613 |
// Set proxy settings. |
|
1614 |
if (variable_get('cdm_webservice_proxy_url', FALSE)) { |
|
1615 |
curl_setopt($ch, CURLOPT_PROXY, variable_get('cdm_webservice_proxy_url', '')); |
|
1616 |
curl_setopt($ch, CURLOPT_PROXYPORT, variable_get('cdm_webservice_proxy_port', '80')); |
|
1617 |
if (variable_get('cdm_webservice_proxy_usr', FALSE)) { |
|
1618 |
curl_setopt($ch, CURLOPT_PROXYUSERPWD, variable_get('cdm_webservice_proxy_usr', '') . ':' . variable_get('cdm_webservice_proxy_pwd', '')); |
|
1619 |
} |
|
1620 |
} |
|
1621 |
|
|
1622 |
// Modify headers array to be used by curl. |
|
1623 |
foreach ($headers as $header_key => $header_val) { |
|
1624 |
$curl_headers[] = $header_key . ': ' . $header_val; |
|
1625 |
} |
|
1626 |
if (isset($curl_headers)) { |
|
1627 |
curl_setopt($ch, CURLOPT_HTTPHEADER, $curl_headers); |
|
1628 |
} |
|
1629 |
|
|
1630 |
// Set method if not default. |
|
1631 |
if ($method != "GET") { |
|
1632 |
if ($method == "POST") { |
|
1633 |
|
|
1634 |
curl_setopt($ch, CURLOPT_POST, 1); |
|
1635 |
curl_setopt($ch, CURLOPT_POSTFIELDS, $parameters); |
|
1636 |
} |
|
1637 |
else { |
|
1638 |
// Other obscure http methods get passed to curl directly. |
|
1639 |
// TODO generic parameter/body handling |
|
1640 |
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); |
|
1641 |
} |
|
1642 |
} |
|
1643 |
|
|
1644 |
ob_start(); |
|
1645 |
curl_exec($ch); |
|
1646 |
$info = curl_getinfo($ch); |
|
1647 |
if (curl_errno($ch)) { |
|
1648 |
watchdog('CDM_API', '_http_request_curl() - ' . curl_error($ch) . '; REQUEST-METHOD:' . $method . ' URL: ' . substr($uri . ' ', 0, 150), WATCHDOG_ERROR); |
|
1649 |
if (variable_get('cdm_webservice_debug', 1) && user_access('administer')) { |
|
1650 |
drupal_set_message(check_plain(t('_http_request_curl() - !curl_error; REQUEST-METHOD:!method URL: !url', array( |
|
1651 |
'!curl_error' => curl_error($ch), |
|
1652 |
'!method' => $method, |
|
1653 |
'!url' => substr($uri . ' ', 0, 150), |
|
1654 |
))), 'error'); |
|
1655 |
} |
|
1656 |
} |
|
1657 |
curl_close($ch); |
|
1658 |
$string = ob_get_contents(); |
|
1659 |
ob_end_clean(); |
|
1660 |
|
|
1661 |
return $string; |
|
1662 |
} |
|
1663 |
|
|
1664 | 1579 |
/** |
1665 | 1580 |
* @todo Please document this function. |
1666 | 1581 |
* @see http://drupal.org/node/1354 |
7.x/modules/cdm_dataportal/translations/cdm_dataportal_general.pot.template | ||
---|---|---|
1103 | 1103 |
msgid "No 'FeatureTree' has been set so far.\n In order to see the species profiles of your taxa, please select a\n 'FeatureTree' in the !settings" |
1104 | 1104 |
msgstr "" |
1105 | 1105 |
|
1106 |
#: cdm_api/cdm_api.module:1422 |
|
1107 |
msgid "_http_request_curl() - !curl_error; REQUEST-METHOD:!method URL: !url" |
|
1108 |
msgstr "" |
|
1109 |
|
|
1110 | 1106 |
#: cdm_api/cdm_api.module:1503 |
1111 | 1107 |
msgid "Default Featuretree (contains all features)" |
1112 | 1108 |
msgstr "" |
... | ... | |
1131 | 1127 |
msgid "CDM API" |
1132 | 1128 |
msgstr "" |
1133 | 1129 |
|
1134 |
#: (duplicate) cdm_api/cdm_api.install:130 |
|
1135 |
msgid "\n CURL php extension is available and will be used by the CDM API.\n HTTP requests thus will be up to 20x faster." |
|
1136 |
msgstr "" |
|
1137 |
|
|
1138 |
#: (duplicate) cdm_api/cdm_api.install:136 |
|
1139 |
msgid "CURL php extension is missing. If\n CURL lib is installed HTTP requests will be up to 20x faster." |
|
1140 |
msgstr "" |
|
1141 |
|
|
1142 | 1130 |
#: cdm_api/cdm_api.info:0 |
1143 | 1131 |
msgid "CDM Web Service API" |
1144 | 1132 |
msgstr "" |
7.x/modules/cdm_dataportal/translations/cdm_dataportal_installer.pot.template | ||
---|---|---|
20 | 20 |
"Content-Transfer-Encoding: 8bit\n" |
21 | 21 |
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" |
22 | 22 |
|
23 |
#: (duplicate) cdm_api/cdm_api.install:124
|
|
23 |
#: (duplicate) cdm_api/cdm_api.install:124 |
|
24 | 24 |
msgid "CDM API" |
25 | 25 |
msgstr "" |
26 | 26 |
|
27 |
#: (duplicate) cdm_api/cdm_api.install:130 |
|
28 |
msgid "\n CURL php extension is available and will be used by the CDM API.\n HTTP requests thus will be up to 20x faster." |
|
29 |
msgstr "" |
|
30 |
|
|
31 |
#: (duplicate) cdm_api/cdm_api.install:136 |
|
32 |
msgid "CURL php extension is missing. If\n CURL lib is installed HTTP requests will be up to 20x faster." |
|
33 |
msgstr "" |
|
34 |
|
|
35 | 27 |
#: profile/CDM_Portal/CDM_Portal.profile:14 profile/CDM_Portal_Testing/CDM_Portal_Testing.profile:14 |
36 | 28 |
msgid "EDIT CDM DataPortal" |
37 | 29 |
msgstr "" |
Also available in: Unified diff
removing curl based http request support - we now rely only on the drupal built in function drupal_http_request()