public function ReadinessValidationManager::run in Automatic Updates 8.2
Dispatches the readiness check event and stores the results.
Return value
$this
1 call to ReadinessValidationManager::run()
- ReadinessValidationManager::runIfNoStoredResults in src/
Validation/ ReadinessValidationManager.php - Dispatches the readiness check event if there no stored valid results.
File
- src/
Validation/ ReadinessValidationManager.php, line 81
Class
- ReadinessValidationManager
- Defines a manager to run readiness validation.
Namespace
Drupal\automatic_updates\ValidationCode
public function run() : self {
$composer = ComposerUtility::createForDirectory($this->pathLocator
->getActiveDirectory());
$recommender = new UpdateRecommender();
$release = $recommender
->getRecommendedRelease(TRUE);
if ($release) {
$core_packages = $composer
->getCorePackageNames();
// Update all core packages to the same version.
$package_versions = array_fill(0, count($core_packages), $release
->getVersion());
$package_versions = array_combine($core_packages, $package_versions);
}
else {
$package_versions = [];
}
$event = new ReadinessCheckEvent($composer, $package_versions);
$this->eventDispatcher
->dispatch($event, AutomaticUpdatesEvents::READINESS_CHECK);
$results = $event
->getResults();
$this->keyValueExpirable
->setWithExpire('readiness_validation_last_run', [
'results' => $results,
'listeners' => $this
->getListenersAsString(AutomaticUpdatesEvents::READINESS_CHECK),
], $this->resultsTimeToLive * 60 * 60);
$this->keyValueExpirable
->set('readiness_check_timestamp', $this->time
->getRequestTime());
return $this;
}