UpdateManagerInterface.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?php
  2. namespace Drupal\update;
  3. /**
  4. * Manages project update information.
  5. */
  6. interface UpdateManagerInterface {
  7. /**
  8. * Project is missing security update(s).
  9. */
  10. const NOT_SECURE = 1;
  11. /**
  12. * Current release has been unpublished and is no longer available.
  13. */
  14. const REVOKED = 2;
  15. /**
  16. * Current release is no longer supported by the project maintainer.
  17. */
  18. const NOT_SUPPORTED = 3;
  19. /**
  20. * Project has a new release available, but it is not a security release.
  21. */
  22. const NOT_CURRENT = 4;
  23. /**
  24. * Project is up to date.
  25. */
  26. const CURRENT = 5;
  27. /**
  28. * Fetches an array of installed and enabled projects.
  29. *
  30. * This is only responsible for generating an array of projects (taking into
  31. * account projects that include more than one module or theme). Other
  32. * information like the specific version and install type (official release,
  33. * dev snapshot, etc) is handled later in update_process_project_info() since
  34. * that logic is only required when preparing the status report, not for
  35. * fetching the available release data.
  36. *
  37. * This array is fairly expensive to construct, since it involves a lot of
  38. * disk I/O, so we store the results. However, since this is not the data
  39. * about available updates fetched from the network, it is acceptable to
  40. * invalidate it somewhat quickly. If we keep this data for very long, site
  41. * administrators are more likely to see incorrect results if they upgrade to
  42. * a newer version of a module or theme but do not visit certain pages that
  43. * automatically clear this data.
  44. *
  45. * @return array
  46. * An associative array of currently enabled projects keyed by the
  47. * machine-readable project short name. Each project contains:
  48. * - name: The machine-readable project short name.
  49. * - info: An array with values from the main .info.yml file for this
  50. * project.
  51. * - name: The human-readable name of the project.
  52. * - package: The package that the project is grouped under.
  53. * - version: The version of the project.
  54. * - project: The Drupal.org project name.
  55. * - datestamp: The date stamp of the project's main .info.yml file.
  56. * - _info_file_ctime: The maximum file change time for all of the
  57. * .info.yml
  58. * files included in this project.
  59. * - datestamp: The date stamp when the project was released, if known.
  60. * - includes: An associative array containing all projects included with
  61. * this project, keyed by the machine-readable short name with the
  62. * human-readable name as value.
  63. * - project_type: The type of project. Allowed values are 'module' and
  64. * 'theme'.
  65. * - project_status: This indicates if the project is enabled and will
  66. * always be TRUE, as the function only returns enabled projects.
  67. *
  68. * @see update_process_project_info()
  69. * @see update_calculate_project_data()
  70. * @see \Drupal\update\UpdateManager::projectStorage()
  71. */
  72. public function getProjects();
  73. /**
  74. * Processes a step in batch for fetching available update data.
  75. *
  76. * @param array $context
  77. * Reference to an array used for Batch API storage.
  78. */
  79. public function fetchDataBatch(&$context);
  80. /**
  81. * Clears out all the available update data and initiates re-fetching.
  82. */
  83. public function refreshUpdateData();
  84. /**
  85. * Retrieves update storage data or empties it.
  86. *
  87. * Two very expensive arrays computed by this module are the list of all
  88. * installed modules and themes (and .info.yml data, project associations,
  89. * etc), and the current status of the site relative to the currently
  90. * available releases. These two arrays are stored and used whenever possible.
  91. * The data is cleared whenever the administrator visits the status report,
  92. * available updates report, or the module or theme administration pages,
  93. * since we should always recompute the most current values on any of those
  94. * pages.
  95. *
  96. * Note: while both of these arrays are expensive to compute (in terms of disk
  97. * I/O and some fairly heavy CPU processing), neither of these is the actual
  98. * data about available updates that we have to fetch over the network from
  99. * updates.drupal.org. That information is stored in the
  100. * 'update_available_releases' collection -- it needs to persist longer than 1
  101. * hour and never get invalidated just by visiting a page on the site.
  102. *
  103. * @param string $key
  104. * The key of data to return. Valid options are 'update_project_data' and
  105. * 'update_project_projects'.
  106. *
  107. * @return array
  108. * The stored value of the $projects array generated by
  109. * update_calculate_project_data() or
  110. * \Drupal\Update\UpdateManager::getProjects(), or an empty array when the
  111. * storage is cleared.
  112. * array when the storage is cleared.
  113. */
  114. public function projectStorage($key);
  115. }