You are here

lightning_core.drush.inc in Lightning Core 8.5

Drush integration for Lightning.

File

lightning_core.drush.inc
View source
<?php

/**
 * @file
 * Drush integration for Lightning.
 */

/**
 * Implements drush_hook_COMMAND_validate().
 */
function drush_lightning_core_pm_updatecode_validate() {
  $lightning_path = Drupal::moduleHandler()
    ->getModule('lightning')
    ->getPath();
  $question = dt('Updating code with Drush can potentially break your Lightning site. (See @path for safe update instructions.) Are you SURE you want to continue?', [
    '@path' => Drupal::root() . "/{$lightning_path}/UPDATE.md",
  ]);
  return drush_confirm($question);
}

/**
 * Implements drush_hook_pre_COMMAND().
 */
function drush_lightning_core_pre_updatedb() {

  // 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.
  if (Drupal::hasContainer()) {
    Drupal::service('plugin.cache_clearer')
      ->clearCachedDefinitions();
  }
}

Functions

Namesort descending Description
drush_lightning_core_pm_updatecode_validate Implements drush_hook_COMMAND_validate().
drush_lightning_core_pre_updatedb Implements drush_hook_pre_COMMAND().