redis.install 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * @file
  4. * Redis install related functions.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function redis_requirements($phase) {
  10. // This module is configured via settings.php file. Using any other phase
  11. // than runtime to proceed to some consistency checks is useless.
  12. if ('runtime' !== $phase) {
  13. return array();
  14. }
  15. $requirements = array();
  16. try {
  17. Redis_Client::getClient();
  18. $requirements['redis'] = array(
  19. 'title' => "Redis",
  20. 'value' => t("Connected, using the <em>@name</em> client.", array('@name' => Redis_Client::getClientInterfaceName())),
  21. 'severity' => REQUIREMENT_OK,
  22. );
  23. } catch (Exception $e) {
  24. $requirements['redis'] = array(
  25. 'title' => "Redis",
  26. 'value' => t("Not connected."),
  27. 'severity' => REQUIREMENT_WARNING,
  28. 'description' => t("No Redis client connected. Please ensure that your Redis connection is working properly. If you are not using a Redis server connection you should disable this module."),
  29. );
  30. }
  31. return $requirements;
  32. }