UpdateFetcherInterface.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace Drupal\update;
  3. /**
  4. * Fetches project information from remote locations.
  5. */
  6. interface UpdateFetcherInterface {
  7. /**
  8. * Project's status cannot be checked.
  9. */
  10. const NOT_CHECKED = -1;
  11. /**
  12. * No available update data was found for project.
  13. */
  14. const UNKNOWN = -2;
  15. /**
  16. * There was a failure fetching available update data for this project.
  17. */
  18. const NOT_FETCHED = -3;
  19. /**
  20. * We need to (re)fetch available update data for this project.
  21. */
  22. const FETCH_PENDING = -4;
  23. /**
  24. * Returns the base of the URL to fetch available update data for a project.
  25. *
  26. * @param array $project
  27. * The array of project information from
  28. * \Drupal\Update\UpdateManager::getProjects().
  29. *
  30. * @return string
  31. * The base of the URL used for fetching available update data. This does
  32. * not include the path elements to specify a particular project, version,
  33. * site_key, etc.
  34. */
  35. public function getFetchBaseUrl($project);
  36. /**
  37. * Retrieves the project information.
  38. *
  39. * @param array $project
  40. * The array of project information from
  41. * \Drupal\Update\UpdateManager::getProjects().
  42. * @param string $site_key
  43. * (optional) The anonymous site key hash. Defaults to an empty string.
  44. *
  45. * @return string
  46. * The project information fetched as string. Empty string upon failure.
  47. */
  48. public function fetchProjectData(array $project, $site_key = '');
  49. /**
  50. * Generates the URL to fetch information about project updates.
  51. *
  52. * This figures out the right URL to use, based on the project's .info.yml
  53. * file and the global defaults. Appends optional query arguments when the
  54. * site is configured to report usage stats.
  55. *
  56. * @param array $project
  57. * The array of project information from
  58. * \Drupal\Update\UpdateManager::getProjects().
  59. * @param string $site_key
  60. * (optional) The anonymous site key hash. Defaults to an empty string.
  61. *
  62. * @return string
  63. * The URL for fetching information about updates to the specified project.
  64. *
  65. * @see \Drupal\update\UpdateProcessor::fetchData()
  66. * @see \Drupal\update\UpdateProcessor::processFetchTask()
  67. * @see \Drupal\update\UpdateManager::getProjects()
  68. */
  69. public function buildFetchUrl(array $project, $site_key = '');
  70. }