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_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. if (function_exists('_update_cache_clear')) {
  59. _update_cache_clear('update_project_data');
  60. _update_cache_clear('update_project_projects');
  61. }
  62. $data = update_calculate_project_data($info);
  63. foreach ($data as $project_name => $project) {
  64. // Discard custom projects.
  65. if ($project['status'] == UPDATE_UNKNOWN) {
  66. unset($data[$project_name]);
  67. continue;
  68. }
  69. // Discard projects with unknown installation path.
  70. if ($project_name != 'drupal' && !isset($projects[$project_name]['path'])) {
  71. unset($data[$project_name]);
  72. continue;
  73. }
  74. // Allow to update disabled projects.
  75. if (in_array($project['project_type'], array('disabled-module', 'disabled-theme'))) {
  76. $data[$project_name]['project_type'] = substr($project['project_type'], strpos($project['project_type'], '-') + 1);
  77. }
  78. // Add some info from the project to $data.
  79. $data[$project_name] += array(
  80. 'path' => $projects[$project_name]['path'],
  81. 'label' => $projects[$project_name]['label'],
  82. );
  83. }
  84. return $data;
  85. }