uc_authorizenet.install 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the uc_authorizenet module.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function uc_authorizenet_requirements($phase) {
  10. $t = get_t();
  11. $has_curl = function_exists('curl_init');
  12. $requirements['uc_authorizenet_curl'] = array(
  13. 'title' => $t('cURL'),
  14. 'value' => $has_curl ? $t('Enabled') : $t('Not found'),
  15. );
  16. if (!$has_curl) {
  17. $requirements['uc_authorizenet_curl']['severity'] = REQUIREMENT_ERROR;
  18. $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'));
  19. }
  20. return $requirements;
  21. }
  22. /**
  23. * Implements hook_uninstall().
  24. */
  25. function uc_authorizenet_uninstall() {
  26. // Delete related variables all at once.
  27. db_delete('variable')
  28. ->condition('name', 'uc_authnet_%', 'LIKE')
  29. ->execute();
  30. }
  31. /**
  32. * Implements hook_update_last_removed().
  33. */
  34. function uc_authorizenet_update_last_removed() {
  35. return 3;
  36. }