diff --git a/core/modules/update/lib/Drupal/update/UpdateFetcher.php b/core/modules/update/lib/Drupal/update/UpdateFetcher.php index f1600a7..047ef0e 100644 --- a/core/modules/update/lib/Drupal/update/UpdateFetcher.php +++ b/core/modules/update/lib/Drupal/update/UpdateFetcher.php @@ -14,7 +14,7 @@ /** * Fetches project information from remote locations. */ -class UpdateFetcher { +class UpdateFetcher implements UpdateFetcherInterface { /** * URL to check for updates, if a given project doesn't define its own. @@ -57,15 +57,7 @@ public function __construct(ConfigFactory $config_factory, ClientInterface $http } /** - * Retrieves the project information. - * - * @param array $project - * The array of project information from update_get_projects(). - * @param string $site_key - * (optional) The anonymous site key hash. Defaults to an empty string. - * - * @return string - * The project information fetched as string. Empty string upon failure. + * {@inheritdoc} */ public function fetchProjectData(array $project, $site_key = '') { $url = $this->buildFetchUrl($project, $site_key); @@ -83,23 +75,7 @@ public function fetchProjectData(array $project, $site_key = '') { } /** - * Generates the URL to fetch information about project updates. - * - * This figures out the right URL to use, based on the project's .info.yml file - * and the global defaults. Appends optional query arguments when the site is - * configured to report usage stats. - * - * @param array $project - * The array of project information from update_get_projects(). - * @param string $site_key - * (optional) The anonymous site key hash. Defaults to an empty string. - * - * @return string - * The URL for fetching information about updates to the specified project. - * - * @see \Drupal\update\UpdateProcessor::fetchData() - * @see \Drupal\update\UpdateProcessor::processFetchTask() - * @see \Drupal\update\UpdateManager::getProjects() + * {@inheritdoc} */ public function buildFetchUrl(array $project, $site_key = '') { $name = $project['name']; @@ -129,15 +105,7 @@ public function buildFetchUrl(array $project, $site_key = '') { } /** - * Returns the base of the URL to fetch available update data for a project. - * - * @param array $project - * The array of project information from update_get_projects(). - * - * @return string - * The base of the URL used for fetching available update data. This does - * not include the path elements to specify a particular project, version, - * site_key, etc. + * {@inheritdoc} */ public function getFetchBaseUrl($project) { if (isset($project['info']['project status url'])) { diff --git a/core/modules/update/lib/Drupal/update/UpdateFetcherInterface.php b/core/modules/update/lib/Drupal/update/UpdateFetcherInterface.php new file mode 100644 index 0000000..8ace958 --- /dev/null +++ b/core/modules/update/lib/Drupal/update/UpdateFetcherInterface.php @@ -0,0 +1,60 @@ +updateSettings = $config_factory->get('update.settings'); $this->moduleHandler = $module_handler; $this->updateProcessor = $update_processor; diff --git a/core/modules/update/lib/Drupal/update/UpdateProcessor.php b/core/modules/update/lib/Drupal/update/UpdateProcessor.php index 0237fda..f9a5018 100644 --- a/core/modules/update/lib/Drupal/update/UpdateProcessor.php +++ b/core/modules/update/lib/Drupal/update/UpdateProcessor.php @@ -16,7 +16,7 @@ /** * Process project update information. */ -class UpdateProcessor { +class UpdateProcessor implements UpdateProcessorInterface { /** * The update settings @@ -28,7 +28,7 @@ class UpdateProcessor { /** * The UpdateFetcher service. * - * @var \Drupal\update\UpdateFetcher + * @var \Drupal\update\UpdateFetcherInterface */ protected $updateFetcher; @@ -88,7 +88,7 @@ class UpdateProcessor { * The config factory. * @param \Drupal\Core\Queue\QueueFactory $queue_factory * The queue factory - * @param \Drupal\update\UpdateFetcher $update_fetcher + * @param \Drupal\update\UpdateFetcherInterface $update_fetcher * The update fetcher service * @param \Drupal\Core\KeyValueStore\StateInterface $state_store * The state service. @@ -99,7 +99,7 @@ class UpdateProcessor { * @param \Drupal\Core\KeyValueStore\KeyValueFactoryInterface $key_value_expirable_factory * The expirable key/value factory. */ - public function __construct(ConfigFactory $config_factory, QueueFactory $queue_factory, UpdateFetcher $update_fetcher, StateInterface $state_store, PrivateKey $private_key, KeyValueFactoryInterface $key_value_factory, KeyValueFactoryInterface $key_value_expirable_factory) { + public function __construct(ConfigFactory $config_factory, QueueFactory $queue_factory, UpdateFetcherInterface $update_fetcher, StateInterface $state_store, PrivateKey $private_key, KeyValueFactoryInterface $key_value_factory, KeyValueFactoryInterface $key_value_expirable_factory) { $this->updateFetcher = $update_fetcher; $this->updateSettings = $config_factory->get('update.settings'); $this->fetchQueue = $queue_factory->get('update_fetch_tasks'); diff --git a/core/modules/update/lib/Drupal/update/UpdateProcessorInterface.php b/core/modules/update/lib/Drupal/update/UpdateProcessorInterface.php new file mode 100644 index 0000000..d41a57e --- /dev/null +++ b/core/modules/update/lib/Drupal/update/UpdateProcessorInterface.php @@ -0,0 +1,84 @@ +