public function Updater::executeUpdate in Update helper 8
Same name and namespace in other branches
- 2.x src/Updater.php \Drupal\update_helper\Updater::executeUpdate()
Execute update of configuration from update definitions.
Parameters
string $module: Module name where update definition is saved.
string $update_definition_name: Update definition name. Usually same name as update hook.
Overrides UpdaterInterface::executeUpdate
File
- src/
Updater.php, line 133
Class
- Updater
- Helper class to update configuration.
Namespace
Drupal\update_helperCode
public function executeUpdate($module, $update_definition_name) {
$this->warningCount = 0;
$update_definitions = $this->configHandler
->loadUpdate($module, $update_definition_name);
if (isset($update_definitions[UpdateDefinitionInterface::GLOBAL_ACTIONS])) {
$this
->executeGlobalActions($update_definitions[UpdateDefinitionInterface::GLOBAL_ACTIONS]);
unset($update_definitions[UpdateDefinitionInterface::GLOBAL_ACTIONS]);
}
if (!empty($update_definitions)) {
$this
->executeConfigurationActions($update_definitions);
}
// Dispatch event after update has finished.
$event = new ConfigurationUpdateEvent($module, $update_definition_name, $this->warningCount);
$this->eventDispatcher
->dispatch(UpdateHelperEvents::CONFIGURATION_UPDATE, $event);
return $this->warningCount === 0;
}