public function UpdateManager::executeAllInConsole in Lightning Core 8.5
Same name and namespace in other branches
- 8 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::executeAllInConsole()
- 8.2 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::executeAllInConsole()
- 8.3 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::executeAllInConsole()
- 8.4 src/UpdateManager.php \Drupal\lightning_core\UpdateManager::executeAllInConsole()
Executes all available updates in a console context.
Parameters
\Symfony\Component\Console\Style\StyleInterface $style: The I/O style.
File
- src/
UpdateManager.php, line 210
Class
- UpdateManager
- Discovers and manages optional configuration updates.
Namespace
Drupal\lightning_coreCode
public function executeAllInConsole(StyleInterface $style) {
$updates = $this
->getAvailable();
if (count($updates) === 0) {
return $style
->text('There are no updates available.');
}
$style
->text("Executing all available updates...");
$provider = NULL;
$versions = $this->configFactory
->getEditable(static::CONFIG_NAME);
foreach ($updates as $update) {
if ($update['provider'] != $provider) {
$provider = $update['provider'];
$style
->text($provider . ' ' . $update['id']);
}
$handler = $this->classResolver
->getInstanceFromDefinition($update['class']);
/** @var \Drupal\lightning_core\UpdateTask $task */
foreach ($this
->getTasks($handler) as $task) {
$task
->execute($style);
}
$versions
->set($provider, $update['id'])
->save();
}
}