Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 namespace Drupal\update;
|
Chris@0
|
4
|
Chris@0
|
5 /**
|
Chris@0
|
6 * Processor of project update information.
|
Chris@0
|
7 */
|
Chris@0
|
8 interface UpdateProcessorInterface {
|
Chris@0
|
9
|
Chris@0
|
10 /**
|
Chris@0
|
11 * Claims an item in the update fetch queue for processing.
|
Chris@0
|
12 *
|
Chris@0
|
13 * @return bool|\stdClass
|
Chris@0
|
14 * On success we return an item object. If the queue is unable to claim an
|
Chris@0
|
15 * item it returns false.
|
Chris@0
|
16 *
|
Chris@0
|
17 * @see \Drupal\Core\Queue\QueueInterface::claimItem()
|
Chris@0
|
18 */
|
Chris@0
|
19 public function claimQueueItem();
|
Chris@0
|
20
|
Chris@0
|
21 /**
|
Chris@0
|
22 * Attempts to drain the queue of tasks for release history data to fetch.
|
Chris@0
|
23 */
|
Chris@0
|
24 public function fetchData();
|
Chris@0
|
25
|
Chris@0
|
26 /**
|
Chris@0
|
27 * Adds a task to the queue for fetching release history data for a project.
|
Chris@0
|
28 *
|
Chris@0
|
29 * We only create a new fetch task if there's no task already in the queue for
|
Chris@0
|
30 * this particular project (based on 'update_fetch_task' key-value
|
Chris@0
|
31 * collection).
|
Chris@0
|
32 *
|
Chris@0
|
33 * @param array $project
|
Chris@0
|
34 * Associative array of information about a project as created by
|
Chris@0
|
35 * \Drupal\Update\UpdateManager::getProjects(), including keys such as
|
Chris@0
|
36 * 'name' (short name), and the 'info' array with data from a .info.yml
|
Chris@0
|
37 * file for the project.
|
Chris@0
|
38 *
|
Chris@0
|
39 * @see \Drupal\update\UpdateManager::getProjects()
|
Chris@0
|
40 * @see update_get_available()
|
Chris@0
|
41 * @see \Drupal\update\UpdateManager::refreshUpdateData()
|
Chris@0
|
42 * @see \Drupal\update\UpdateProcessor::fetchData()
|
Chris@0
|
43 * @see \Drupal\update\UpdateProcessor::processFetchTask()
|
Chris@0
|
44 */
|
Chris@0
|
45 public function createFetchTask($project);
|
Chris@0
|
46
|
Chris@0
|
47 /**
|
Chris@0
|
48 * Processes a task to fetch available update data for a single project.
|
Chris@0
|
49 *
|
Chris@0
|
50 * Once the release history XML data is downloaded, it is parsed and saved in
|
Chris@0
|
51 * an entry just for that project.
|
Chris@0
|
52 *
|
Chris@0
|
53 * @param array $project
|
Chris@0
|
54 * Associative array of information about the project to fetch data for.
|
Chris@0
|
55 *
|
Chris@0
|
56 * @return bool
|
Chris@0
|
57 * TRUE if we fetched parsable XML, otherwise FALSE.
|
Chris@0
|
58 */
|
Chris@0
|
59 public function processFetchTask($project);
|
Chris@0
|
60
|
Chris@0
|
61 /**
|
Chris@0
|
62 * Retrieves the number of items in the update fetch queue.
|
Chris@0
|
63 *
|
Chris@0
|
64 * @return int
|
Chris@0
|
65 * An integer estimate of the number of items in the queue.
|
Chris@0
|
66 *
|
Chris@0
|
67 * @see \Drupal\Core\Queue\QueueInterface::numberOfItems()
|
Chris@0
|
68 */
|
Chris@0
|
69 public function numberOfQueueItems();
|
Chris@0
|
70
|
Chris@0
|
71 /**
|
Chris@0
|
72 * Deletes a finished item from the update fetch queue.
|
Chris@0
|
73 *
|
Chris@0
|
74 * @param \stdClass $item
|
Chris@0
|
75 * The item returned by \Drupal\Core\Queue\QueueInterface::claimItem().
|
Chris@0
|
76 *
|
Chris@0
|
77 * @see \Drupal\Core\Queue\QueueInterface::deleteItem()
|
Chris@0
|
78 */
|
Chris@0
|
79 public function deleteQueueItem($item);
|
Chris@0
|
80
|
Chris@0
|
81 }
|