StatusInfoDrupal6.php

  1. 8.0.x lib/Drush/UpdateService/StatusInfoDrupal6.php
  2. 7.x lib/Drush/UpdateService/StatusInfoDrupal6.php

Implementation of 'drupal' update_status engine for Drupal 6.

Namespace

Drush\UpdateService

Classes

Namesort descending Description
StatusInfoDrupal6

File

lib/Drush/UpdateService/StatusInfoDrupal6.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Implementation of 'drupal' update_status engine for Drupal 6.
  5. */
  6. namespace Drush\UpdateService;
  7. class StatusInfoDrupal6 extends StatusInfoDrupal7 {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. function beforeGetStatus(&$projects, $check_disabled) {
  12. // If check-disabled option was provided, alter Drupal settings temporarily.
  13. // There's no other way to hook into this.
  14. if (!is_null($check_disabled)) {
  15. global $conf;
  16. $this->update_check_disabled = $conf['update_advanced_check_disabled'];
  17. $conf['update_advanced_check_disabled'] = $check_disabled;
  18. }
  19. }
  20. /**
  21. * {@inheritdoc}
  22. */
  23. function afterGetStatus(&$update_info, $projects, $check_disabled) {
  24. // Restore Drupal settings.
  25. if (!is_null($check_disabled)) {
  26. global $conf;
  27. $conf['update_advanced_check_disabled'] = $this->update_check_disabled;
  28. unset($this->update_check_disabled);
  29. }
  30. // update_advanced.module sets a different project type
  31. // for disabled projects. Here we normalize it.
  32. if ($check_disabled) {
  33. foreach ($update_info as $key => $project) {
  34. if (in_array($project['project_type'], array('disabled-module', 'disabled-theme'))) {
  35. $update_info[$key]['project_type'] = substr($project['project_type'], strpos($project['project_type'], '-') + 1);
  36. }
  37. }
  38. }
  39. }
  40. /**
  41. * Obtains release info for all installed projects via update.module.
  42. *
  43. * @see update_get_available().
  44. * @see update_manual_status().
  45. */
  46. protected function getAvailableReleases() {
  47. // We force a refresh if the cache is not available.
  48. if (!cache_get('update_available_releases', 'cache_update')) {
  49. $this->refresh();
  50. }
  51. $available = update_get_available(TRUE);
  52. // Force to invalidate some update_status caches that are only cleared
  53. // when visiting update status report page.
  54. if (function_exists('_update_cache_clear')) {
  55. _update_cache_clear('update_project_data');
  56. _update_cache_clear('update_project_projects');
  57. }
  58. return $available;
  59. }
  60. }