interface UpdateManagerInterface
Same name and namespace in other branches
- 11.x core/modules/update/src/UpdateManagerInterface.php \Drupal\update\UpdateManagerInterface
- 10 core/modules/update/src/UpdateManagerInterface.php \Drupal\update\UpdateManagerInterface
- 9 core/modules/update/src/UpdateManagerInterface.php \Drupal\update\UpdateManagerInterface
- 8.9.x core/modules/update/src/UpdateManagerInterface.php \Drupal\update\UpdateManagerInterface
Manages project update information.
Hierarchy
- interface \Drupal\update\UpdateManagerInterface
Expanded class hierarchy of UpdateManagerInterface
All classes that implement UpdateManagerInterface
16 files declare their use of UpdateManagerInterface
- DevReleaseTest.php in core/
modules/ update/ tests/ src/ Kernel/ DevReleaseTest.php - ProjectInfo.php in core/
modules/ package_manager/ src/ ProjectInfo.php - ProjectInfoTest.php in core/
modules/ package_manager/ tests/ src/ Kernel/ ProjectInfoTest.php - update.compare.inc in core/
modules/ update/ update.compare.inc - update.fetch.inc in core/
modules/ update/ update.fetch.inc
File
-
core/
modules/ update/ src/ UpdateManagerInterface.php, line 8
Namespace
Drupal\updateView source
interface UpdateManagerInterface {
/**
* Project is missing security update(s).
*/
const NOT_SECURE = 1;
/**
* Current release has been unpublished and is no longer available.
*/
const REVOKED = 2;
/**
* Current release is no longer supported by the project maintainer.
*/
const NOT_SUPPORTED = 3;
/**
* Project has a new release available, but it is not a security release.
*/
const NOT_CURRENT = 4;
/**
* Project is up to date.
*/
const CURRENT = 5;
/**
* Fetches an array of installed projects.
*
* This is only responsible for generating an array of projects (taking into
* account projects that include more than one module or theme). Other
* information like the specific version and install type (official release,
* dev snapshot, etc) is handled later in
* \Drupal\update\UpdateCalculator::processProjectInfo() since that logic is
* only required when preparing the status report, not for fetching the
* available release data.
*
* This array is fairly expensive to construct, since it involves a lot of
* disk I/O, so we store the results. However, since this is not the data
* about available updates fetched from the network, it is acceptable to
* invalidate it somewhat quickly. If we keep this data for very long, site
* administrators are more likely to see incorrect results if they upgrade to
* a newer version of a module or theme but do not visit certain pages that
* automatically clear this data.
*
* @return array
* An associative array of currently installed projects keyed by the
* machine-readable project short name. Each project contains:
* - name: The machine-readable project short name.
* - info: An array with values from the main .info.yml file for this
* project.
* - name: The human-readable name of the project.
* - package: The package that the project is grouped under.
* - version: The version of the project.
* - project: The Drupal.org project name.
* - datestamp: The date stamp of the project's main .info.yml file.
* - _info_file_ctime: The maximum file change time for all of the
* .info.yml
* files included in this project.
* - datestamp: The date stamp when the project was released, if known.
* - includes: An associative array containing all projects included with
* this project, keyed by the machine-readable short name with the
* human-readable name as value.
* - project_type: The type of project. Allowed values are 'module' and
* 'theme'.
* - project_status: This indicates if the project is installed and will
* always be TRUE, as the function only returns installed projects.
*
* @see \Drupal\update\UpdateCalculator::processProjectInfo()
* @see \Drupal\update\UpdateManagerInterface::calculateProjectData()
* @see \Drupal\update\UpdateManagerInterface::projectStorage()
*/
public function getProjects();
/**
* Processes a step in batch for fetching available update data.
*
* Before calling this method, call
* UpdateManagerInterface::refreshUpdateData() to clear existing update data
* and initiate re-fetching.
*
* @param array $context
* Reference to an array used for Batch API storage.
*
* @see \Drupal\update\UpdateManagerInterface::refreshUpdateData()
*/
public function fetchDataBatch(&$context);
/**
* Clears out all the available update data and initiates re-fetching.
*/
public function refreshUpdateData();
/**
* Retrieves update storage data or empties it.
*
* Two very expensive arrays computed by this module are the list of all
* installed modules and themes (and .info.yml data, project associations,
* etc), and the current status of the site relative to the currently
* available releases. These two arrays are stored and used whenever possible.
* The data is cleared whenever the administrator visits the status report,
* available updates report, or the module or theme administration pages,
* since we should always recompute the most current values on any of those
* pages.
*
* Note: while both of these arrays are expensive to compute (in terms of disk
* I/O and some fairly heavy CPU processing), neither of these is the actual
* data about available updates that we have to fetch over the network from
* updates.drupal.org. That information is stored in the
* 'update_available_releases' collection -- it needs to persist longer than 1
* hour and never get invalidated just by visiting a page on the site.
*
* @param string $key
* The key of data to return. Valid options are 'update_project_data' and
* 'update_project_projects'.
*
* @return array
* The stored value of the $projects array generated by
* \Drupal\update\UpdateManagerInterface::calculateProjectData() or
* \Drupal\update\UpdateManagerInterface::getProjects(), or an empty array
* when the storage is cleared.
*/
public function projectStorage($key);
/**
* Tries to get update information and refreshes it when necessary.
*
* In addition to checking the lifetime, this function also ensures that there
* are no .info.yml files for installed modules or themes that have a newer
* modification timestamp than the last time we checked for available update
* data. If any .info.yml file was modified, it almost certainly means a new
* version of something was installed. Without fresh available update data,
* the logic in update_calculate_project_data() will be wrong and produce
* confusing, bogus results.
*
* @param bool $refresh
* (optional) Boolean to indicate if this method should refresh
* automatically if there's no data. Defaults to FALSE.
*
* @return array
* Array of data about available releases, keyed by project shortname.
*
* @see \Drupal\update\UpdateManagerInterface::refreshUpdateData()
* @see \Drupal\update\UpdateManagerInterface::getProjects()
*/
public function getAvailable(bool $refresh) : array;
/**
* Invalidates stored data relating to update status.
*/
public function reset() : void;
/**
* Calculates the current update status of all projects on the site.
*
* The results of this method are expensive to compute, especially on sites
* with lots of modules or themes, since it involves a lot of comparisons and
* other operations. Therefore, we store the results. However, since this is
* not the data about available updates fetched from the network, it is ok to
* invalidate it somewhat quickly. If we keep this data for very long, site
* administrators are more likely to see incorrect results if they upgrade to
* a newer version of a module or theme but do not visit certain pages that
* automatically clear this.
*
* @param array $available
* Data about available project releases.
*
* @return array
* An array of installed projects with current update status information.
*
* @see \Drupal\update\UpdateManagerInterface::getAvailable()
* @see \Drupal\update\UpdateManagerInterface::getProjects()
* @see \Drupal\update\UpdateCalculator::processProjectInfo()
* @see \Drupal\update\UpdateManagerInterface::projectStorage()
* @see \Drupal\update\ProjectCoreCompatibility::setReleaseMessage()
*/
public function calculateProjectData(array $available) : array;
}
Members
| Title Sort descending | Modifiers | Object type | Summary | Overrides |
|---|---|---|---|---|
| UpdateManagerInterface::calculateProjectData | public | function | Calculates the current update status of all projects on the site. | 1 |
| UpdateManagerInterface::CURRENT | constant | Project is up to date. | ||
| UpdateManagerInterface::fetchDataBatch | public | function | Processes a step in batch for fetching available update data. | 1 |
| UpdateManagerInterface::getAvailable | public | function | Tries to get update information and refreshes it when necessary. | 1 |
| UpdateManagerInterface::getProjects | public | function | Fetches an array of installed projects. | 1 |
| UpdateManagerInterface::NOT_CURRENT | constant | Project has a new release available, but it is not a security release. | ||
| UpdateManagerInterface::NOT_SECURE | constant | Project is missing security update(s). | ||
| UpdateManagerInterface::NOT_SUPPORTED | constant | Current release is no longer supported by the project maintainer. | ||
| UpdateManagerInterface::projectStorage | public | function | Retrieves update storage data or empties it. | 1 |
| UpdateManagerInterface::refreshUpdateData | public | function | Clears out all the available update data and initiates re-fetching. | 1 |
| UpdateManagerInterface::reset | public | function | Invalidates stored data relating to update status. | 1 |
| UpdateManagerInterface::REVOKED | constant | Current release has been unpublished and is no longer available. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.