You are here

public function Hooks::preUpdate in Lightning Core 8.2

Same name and namespace in other branches
  1. 8.5 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks::preUpdate()
  2. 8.3 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks::preUpdate()
  3. 8.4 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks::preUpdate()

Clears all plugin discovery caches before database updates begin.

A common cause of errors during database updates is update hooks referring to new or changed plugin definitions. Clearing all plugin caches before updates begin ensures that the plugin system always has the latest plugin definitions to work with.

@hook pre-command updatedb

File

src/Commands/Hooks.php, line 40

Class

Hooks
Implements Drush command hooks.

Namespace

Drupal\lightning_core\Commands

Code

public function preUpdate() {
  $this->pluginCacheClearer
    ->clearCachedDefinitions();
}