function AdvisoriesConfigSubscriber::onConfigSave
Same name in other branches
- 9 core/modules/system/src/EventSubscriber/AdvisoriesConfigSubscriber.php \Drupal\system\EventSubscriber\AdvisoriesConfigSubscriber::onConfigSave()
- 10 core/modules/system/src/EventSubscriber/AdvisoriesConfigSubscriber.php \Drupal\system\EventSubscriber\AdvisoriesConfigSubscriber::onConfigSave()
Deletes the stored response from the security advisories feed, if needed.
The stored response will only be deleted if the 'interval_hours' config setting is reduced from the previous value.
Parameters
\Drupal\Core\Config\ConfigCrudEvent $event: The configuration event.
File
-
core/
modules/ system/ src/ EventSubscriber/ AdvisoriesConfigSubscriber.php, line 41
Class
- AdvisoriesConfigSubscriber
- Defines a config subscriber for changes to 'system.advisories'.
Namespace
Drupal\system\EventSubscriberCode
public function onConfigSave(ConfigCrudEvent $event) : void {
$saved_config = $event->getConfig();
if ($saved_config->getName() === 'system.advisories' && $event->isChanged('interval_hours')) {
$original_interval = $saved_config->getOriginal('interval_hours');
if ($original_interval && $saved_config->get('interval_hours') < $original_interval) {
// If the new interval is less than the original interval, delete the
// stored results.
$this->securityAdvisoriesFetcher
->deleteStoredResponse();
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.