class UpdateEvent in Automatic Updates 8.2
Event fired when a site is updating.
Subscribers to this event should call ::addValidationResult().
Hierarchy
- class \Drupal\automatic_updates\Event\UpdateEvent extends \Drupal\Component\EventDispatcher\Event
Expanded class hierarchy of UpdateEvent
See also
\Drupal\automatic_updates\AutomaticUpdatesEvents
7 files declare their use of UpdateEvent
- ComposerExecutableValidator.php in src/
Validator/ ComposerExecutableValidator.php - DiskSpaceValidator.php in src/
Validator/ DiskSpaceValidator.php - PendingUpdatesValidator.php in src/
Validator/ PendingUpdatesValidator.php - TestChecker1.php in tests/
modules/ automatic_updates_test/ src/ ReadinessChecker/ TestChecker1.php - Updater.php in src/
Updater.php
File
- src/
Event/ UpdateEvent.php, line 16
Namespace
Drupal\automatic_updates\EventView source
class UpdateEvent extends Event {
/**
* The validation results.
*
* @var \Drupal\automatic_updates\Validation\ValidationResult[]
*/
protected $results = [];
/**
* The Composer utility object for the active directory.
*
* @var \Drupal\package_manager\ComposerUtility
*/
protected $activeComposer;
/**
* Constructs a new UpdateEvent object.
*
* @param \Drupal\package_manager\ComposerUtility $active_composer
* A Composer utility object for the active directory.
*/
public function __construct(ComposerUtility $active_composer) {
$this->activeComposer = $active_composer;
}
/**
* Returns a Composer utility object for the active directory.
*
* @return \Drupal\package_manager\ComposerUtility
* The Composer utility object for the active directory.
*/
public function getActiveComposer() : ComposerUtility {
return $this->activeComposer;
}
/**
* Adds a validation result.
*
* @param \Drupal\automatic_updates\Validation\ValidationResult $validation_result
* The validation result.
*/
public function addValidationResult(ValidationResult $validation_result) : void {
$this->results[] = $validation_result;
}
/**
* Gets the validation results.
*
* @param int|null $severity
* (optional) The severity for the results to return. Should be one of the
* SystemManager::REQUIREMENT_* constants.
*
* @return \Drupal\automatic_updates\Validation\ValidationResult[]
* The validation results.
*/
public function getResults(?int $severity = NULL) : array {
if ($severity !== NULL) {
return array_filter($this->results, function ($result) use ($severity) {
return $result
->getSeverity() === $severity;
});
}
return $this->results;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UpdateEvent:: |
protected | property | The Composer utility object for the active directory. | |
UpdateEvent:: |
protected | property | The validation results. | |
UpdateEvent:: |
public | function | Adds a validation result. | |
UpdateEvent:: |
public | function | Returns a Composer utility object for the active directory. | |
UpdateEvent:: |
public | function | Gets the validation results. | |
UpdateEvent:: |
public | function | Constructs a new UpdateEvent object. | 3 |