drupal_7.inc

Functions

Namesort descending Description
pm_get_project_info
pm_update_filter
pm_update_last_check
_pm_get_update_info Get update information for all installed projects.
_pm_refresh Command callback. Refresh update status information.

File

commands/pm/update_info/drupal_7.inc
View source
  1. <?php
  2. function pm_update_filter(&$project) {
  3. $update = FALSE;
  4. switch($project['status']) {
  5. case UPDATE_CURRENT:
  6. $status = dt('Up to date');
  7. $project['candidate_version'] = $project['recommended'];
  8. break;
  9. case UPDATE_NOT_CURRENT:
  10. $status = dt('Update available');
  11. pm_release_recommended($project);
  12. break;
  13. case UPDATE_NOT_SECURE:
  14. $status = dt('SECURITY UPDATE available');
  15. pm_release_recommended($project);
  16. break;
  17. case UPDATE_REVOKED:
  18. $status = dt('Installed version REVOKED');
  19. pm_release_recommended($project);
  20. break;
  21. case UPDATE_NOT_SUPPORTED:
  22. $status = dt('Installed version not supported');
  23. pm_release_recommended($project);
  24. break;
  25. case UPDATE_NOT_CHECKED:
  26. $status = dt('Unable to check status');
  27. break;
  28. case UPDATE_UNKNOWN:
  29. default:
  30. $status = dt('Unknown');
  31. break;
  32. }
  33. return $status;
  34. }
  35. function pm_update_last_check() {
  36. return variable_get('update_last_check', 0);
  37. }
  38. /**
  39. * Command callback. Refresh update status information.
  40. */
  41. function _pm_refresh() {
  42. drush_print(dt("Refreshing update status information ..."));
  43. update_get_available(TRUE);
  44. drush_print(dt("Done."));
  45. }
  46. /**
  47. * Get update information for all installed projects.
  48. *
  49. * @return An array containing remote and local versions for all installed projects
  50. */
  51. function _pm_get_update_info($projects = NULL) {
  52. // We force a refresh if the cache is not available.
  53. if (!cache_get('update_available_releases', 'cache_update')) {
  54. _pm_refresh();
  55. }
  56. $info = update_get_available();
  57. $data = update_calculate_project_data($info);
  58. $data = pm_get_project_path($data, 'includes');
  59. return $data;
  60. }
  61. function pm_get_project_info($projects) {
  62. $data = array();
  63. include_once drupal_get_path('module', 'update') .'/update.fetch.inc';
  64. foreach ($projects as $project_name => $project) {
  65. $url = UPDATE_DEFAULT_URL. "/$project_name/". drush_drupal_major_version() . '.x';
  66. $xml = drupal_http_request($url);
  67. if (isset($xml->error)) {
  68. drush_set_error(dt(
  69. 'HTTP Request to @request has failed. @error',
  70. array('@request' => $xml->request, '@error' => $xml->error)
  71. ));
  72. }
  73. elseif (!$info = update_parse_xml($xml->data)) {
  74. drush_set_error(dt(
  75. 'No release history found for @project_name',
  76. array('@project_name' => $project_name)
  77. ));
  78. }
  79. else {
  80. $data[$project_name] = $info;
  81. }
  82. }
  83. return $data;
  84. }