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