class Hooks in Lightning Core 8.2
Same name and namespace in other branches
- 8.5 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks
- 8.3 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks
- 8.4 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks
Implements Drush command hooks.
Hierarchy
- class \Drupal\lightning_core\Commands\Hooks extends \Drush\Commands\DrushCommands
Expanded class hierarchy of Hooks
1 string reference to 'Hooks'
1 service uses Hooks
File
- src/
Commands/ Hooks.php, line 11
Namespace
Drupal\lightning_core\CommandsView source
class Hooks extends DrushCommands {
/**
* The plugin cache clearer service.
*
* @var \Drupal\Core\Plugin\CachedDiscoveryClearerInterface
*/
protected $pluginCacheClearer;
/**
* Hooks constructor.
*
* @param \Drupal\Core\Plugin\CachedDiscoveryClearerInterface $plugin_cache_clearer
* The plugin cache clearer service.
*/
public function __construct(CachedDiscoveryClearerInterface $plugin_cache_clearer) {
$this->pluginCacheClearer = $plugin_cache_clearer;
}
/**
* 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
*/
public function preUpdate() {
$this->pluginCacheClearer
->clearCachedDefinitions();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Hooks:: |
protected | property | The plugin cache clearer service. | |
Hooks:: |
public | function | Clears all plugin discovery caches before database updates begin. | |
Hooks:: |
public | function | Hooks constructor. |