drupal_6.inc

  1. 6.x commands/pm/update_info/drupal_6.inc
  2. 3.x commands/pm/update_info/drupal_6.inc
  3. 4.x commands/pm/update_info/drupal_6.inc
  4. 5.x commands/pm/update_info/drupal_6.inc

Functions

Namesort descending Description
pm_get_project_info Get project information from drupal.org.
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_6.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. default:
  29. $status = dt('Unknown');
  30. break;
  31. }
  32. return $status;
  33. }
  34. function pm_update_last_check() {
  35. return variable_get('update_last_check', 0);
  36. }
  37. /**
  38. * Command callback. Refresh update status information.
  39. */
  40. function _pm_refresh() {
  41. drush_print(dt("Refreshing update status information ..."));
  42. update_refresh();
  43. drush_print(dt("Done."));
  44. }
  45. /**
  46. * Get update information for all installed projects.
  47. *
  48. * @return An array containing remote and local versions for all installed projects
  49. */
  50. function _pm_get_update_info($projects) {
  51. // We force a refresh if the cache is not available.
  52. if (!cache_get('update_available_releases', 'cache_update')) {
  53. _pm_refresh();
  54. }
  55. $info = update_get_available(TRUE);
  56. // Force to invalidate some update_status caches that are only cleared
  57. // when visiting update status report page.
  58. _update_cache_clear('update_project_data');
  59. _update_cache_clear('update_project_projects');
  60. $data = update_calculate_project_data($info);
  61. foreach ($data as $project_name => $project) {
  62. // Discard custom projects.
  63. if ($project['status'] == UPDATE_UNKNOWN) {
  64. unset($data[$project_name]);
  65. continue;
  66. }
  67. if (in_array($project['project_type'], array('disabled-module', 'disabled-theme'))) {
  68. $data[$project_name]['project_type'] = substr($project['project_type'], strpos($project['project_type'], '-') + 1);
  69. }
  70. $data[$project_name]['includes'] = drupal_map_assoc($projects[$project_name]['extensions']);
  71. }
  72. $data = _pm_get_project_path($data, 'includes');
  73. return $data;
  74. }
  75. /**
  76. * Get project information from drupal.org.
  77. *
  78. * @param $projects An array of project names
  79. */
  80. function pm_get_project_info($projects) {
  81. $info = array();
  82. $data = array();
  83. foreach ($projects as $project_name => $project) {
  84. $url = UPDATE_DEFAULT_URL. "/$project_name/". drush_drupal_major_version() . '.x';
  85. $xml = drupal_http_request($url);
  86. $data[] = $xml->data;
  87. }
  88. if ($data) {
  89. include_once drupal_get_path('module', 'update') .'/update.fetch.inc';
  90. $parser = new update_xml_parser;
  91. $info = $parser->parse($data);
  92. }
  93. return $info;
  94. }