| 1 |
<?php
|
| 2 |
// $Id: simple_paypal.install,v 1.1 2008/10/01 21:59:37 kbahey Exp $
|
| 3 |
|
| 4 |
|
| 5 |
/**
|
| 6 |
* @file
|
| 7 |
* Install, update and uninstall functions for the simple_paypal module.
|
| 8 |
*/
|
| 9 |
|
| 10 |
|
| 11 |
/**
|
| 12 |
* Implement hook_requirements().
|
| 13 |
*
|
| 14 |
* Check that the cURL extension exists for PHP.
|
| 15 |
*/
|
| 16 |
function simple_paypal_requirements($phase) {
|
| 17 |
$requirements = array();
|
| 18 |
$t = get_t();
|
| 19 |
|
| 20 |
$has_curl = function_exists('curl_init');
|
| 21 |
|
| 22 |
switch ($phase) {
|
| 23 |
case 'runtime':
|
| 24 |
$requirements['simple_paypal'] = array(
|
| 25 |
'title' => $t('cURL'),
|
| 26 |
'value' => $has_curl ? $t('Enabled') : $t('Not found'),
|
| 27 |
'severity' => $has_curl ? REQUIREMENT_OK : REQUIREMENT_ERROR,
|
| 28 |
);
|
| 29 |
break;
|
| 30 |
case 'install':
|
| 31 |
if ($has_curl) {
|
| 32 |
$requirements['simple_paypal'] = array(
|
| 33 |
'title' => $t('cURL'),
|
| 34 |
'severity' => REQUIREMENT_OK,
|
| 35 |
);
|
| 36 |
}
|
| 37 |
else {
|
| 38 |
$requirements['simple_paypal'] = array(
|
| 39 |
'title' => $t('cURL'),
|
| 40 |
'severity' => REQUIREMENT_ERROR,
|
| 41 |
'description' => $t('Simple Paypal could not be installed because the PHP <a href="!curl_url">cURL</a> library is not available.', array('!curl_url' => 'http://php.net/manual/en/curl.setup.php')),
|
| 42 |
);
|
| 43 |
}
|
| 44 |
break;
|
| 45 |
}
|
| 46 |
|
| 47 |
return $requirements;
|
| 48 |
}
|