update_script_test.install 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /**
  3. * @file
  4. * Install, update and uninstall functions for the update_script_test module.
  5. */
  6. /**
  7. * Implements hook_requirements().
  8. */
  9. function update_script_test_requirements($phase) {
  10. $requirements = array();
  11. if ($phase == 'update') {
  12. // Set a requirements warning or error when the test requests it.
  13. $requirement_type = variable_get('update_script_test_requirement_type');
  14. switch ($requirement_type) {
  15. case REQUIREMENT_WARNING:
  16. $requirements['update_script_test'] = array(
  17. 'title' => 'Update script test',
  18. 'value' => 'Warning',
  19. 'description' => 'This is a requirements warning provided by the update_script_test module.',
  20. 'severity' => REQUIREMENT_WARNING,
  21. );
  22. break;
  23. case REQUIREMENT_ERROR:
  24. $requirements['update_script_test'] = array(
  25. 'title' => 'Update script test',
  26. 'value' => 'Error',
  27. 'description' => 'This is a requirements error provided by the update_script_test module.',
  28. 'severity' => REQUIREMENT_ERROR,
  29. );
  30. break;
  31. case REQUIREMENT_INFO:
  32. $requirements['update_script_test_stop'] = array(
  33. 'title' => 'Update script test stop',
  34. 'value' => 'Error',
  35. 'description' => 'This is a requirements error provided by the update_script_test module to stop the page redirect for the info.',
  36. 'severity' => REQUIREMENT_ERROR,
  37. );
  38. $requirements['update_script_test'] = array(
  39. 'title' => 'Update script test',
  40. 'description' => 'This is a requirements info provided by the update_script_test module.',
  41. 'severity' => REQUIREMENT_INFO,
  42. );
  43. break;
  44. }
  45. }
  46. return $requirements;
  47. }
  48. /**
  49. * Dummy update function to run during the tests.
  50. */
  51. function update_script_test_update_7000() {
  52. return t('The update_script_test_update_7000() update was executed successfully.');
  53. }