function lightning_core_update_8007 in Lightning Core 8.4
Same name and namespace in other branches
- 8.5 lightning_core.install \lightning_core_update_8007()
- 8 lightning_core.install \lightning_core_update_8007()
- 8.2 lightning_core.install \lightning_core_update_8007()
- 8.3 lightning_core.install \lightning_core_update_8007()
Renames the lightning.versions config object.
1 call to lightning_core_update_8007()
- Update8007Test::testUpdate in tests/
src/ Kernel/ Update/ Update8007Test.php
File
- ./
lightning_core.install, line 131 - Contains install and update routines for Lightning.
Code
function lightning_core_update_8007() {
$config_factory = Drupal::configFactory();
$old = $config_factory
->getEditable('lightning.versions');
$new = $config_factory
->getEditable(UpdateManager::CONFIG_NAME);
// If the new config object didn't exist by the time this update was executed,
// just rename the old config object and call it a day.
if ($new
->isNew()) {
$config_factory
->rename($old
->getName(), $new
->getName());
}
else {
// Meekly merge the old data into the old data (i.e., the new data will take
// precedence), then delete the old config object.
$new
->setData($new
->get() + $old
->get())
->save();
$old
->delete();
}
}