Skip to content

Commit

Permalink
Merge pull request #469 from bugfolder/450_curl_warnings
Browse files Browse the repository at this point in the history
Issues #450: Report cURL status only if it’s needed and is lacking.
  • Loading branch information
bugfolder committed Nov 27, 2023
2 parents 199426f + 599d2ff commit a837593
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
13 changes: 7 additions & 6 deletions payment/uc_authorizenet/uc_authorizenet.install
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
*/
function uc_authorizenet_requirements($phase) {
$t = get_t();
$requirements = array();

$has_curl = function_exists('curl_init');

$requirements['uc_authorizenet_curl'] = array(
'title' => $t('cURL'),
'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);
if (!$has_curl) {
$requirements['uc_authorizenet_curl']['severity'] = REQUIREMENT_ERROR;
$requirements['uc_authorizenet_curl']['description'] = $t("Authorize.net requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php'));
$requirements['uc_authorizenet_curl'] = array(
'title' => $t('cURL'),
'value' => $t('cURL not found'),
'description' => $t("Authorize.net requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php')),
'severity' => REQUIREMENT_ERROR,
);
}

return $requirements;
Expand Down
15 changes: 8 additions & 7 deletions payment/uc_cybersource/uc_cybersource.install
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
function uc_cybersource_requirements($phase) {
$t = get_t();
$requirements = array();

$has_curl = function_exists('curl_init');
$has_dom = class_exists('DOMDocument');
Expand All @@ -31,13 +32,13 @@ function uc_cybersource_requirements($phase) {

// Using POST with cURL.
elseif ($method == 'post') {
$requirements['uc_cybersource_curl'] = array(
'title' => $t('cURL'),
'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);
if (!$has_curl) {
$requirements['uc_cybersource_curl']['severity'] = REQUIREMENT_ERROR;
$requirements['uc_cybersource_curl']['description'] = $t("CyberSource's Silent Order POST requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php'));
$requirements['uc_cybersource_curl'] = array(
'title' => $t('cURL'),
'value' => $t('cURL not found'),
'description' => $t("CyberSource's Silent Order POST requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php')),
'severity' => REQUIREMENT_ERROR,
);
}
}

Expand All @@ -48,7 +49,7 @@ function uc_cybersource_requirements($phase) {
$has_cybersource_hop = uc_cybersource_hop_include();
$requirements['uc_cybersource'] = array(
'title' => t('CyberSource HOP.php'),
'value' => $has_cybersource_hop ? $t('Enabled') : $t('Not found'),
'value' => $has_cybersource_hop ? $t('Enabled') : $t('HOP.php not found'),
);
if (!$has_cybersource_hop) {
$requirements['uc_cybersource']['description'] = t('For instructions on how to generate this file, please refer to <a href="http://www.cybersource.com/support_center/implementation/downloads/hosted_order_page/">CyberSource\'s Hosted Order Pages Documentation</a>, specifically the "Downloading Security Scripts" in Chapter 2 of the <a href="http://apps.cybersource.com/library/documentation/sbc/HOP_UG/html/">HOP User\'s Guide</a>.');
Expand Down
14 changes: 7 additions & 7 deletions payment/uc_paypal/uc_paypal.install
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
* Implements hook_requirements().
*/
function uc_paypal_requirements($phase) {
$requirements = array();
$t = get_t();
$requirements = array();

$has_curl = function_exists('curl_init');

// PayPal WPP requires cURL.
if (config_get('uc_payment.settings', 'uc_pg_paypal_wpp_enabled')) {
$requirements['uc_paypal_curl'] = array(
'title' => $t('cURL'),
'value' => $has_curl ? $t('Enabled') : $t('Not found'),
);
if (!$has_curl) {
$requirements['uc_paypal_curl']['severity'] = REQUIREMENT_ERROR;
$requirements['uc_paypal_curl']['description'] = $t("PayPal WPP requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php'));
$requirements['uc_paypal_curl'] = array(
'title' => $t('cURL'),
'value' => $t('cURL not found'),
'description' =>$t("PayPal WPP requires the PHP <a href='!curl_url'>cURL</a> library.", array('!curl_url' => 'http://php.net/manual/en/curl.setup.php')),
'severity' => REQUIREMENT_ERROR,
);
}
}

Expand Down

0 comments on commit a837593

Please sign in to comment.