comparison core/modules/update/src/UpdateManagerInterface.php @ 0:4c8ae668cc8c

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