function drush_history_path_cli

master cli.drush.inc drush_history_path_cli()

Returns the file path for the CLI history.

This can either be site specific (default) or Drupal version specific.

Return value

string.

1 call to drush_history_path_cli()
drush_cli_core_cli in commands/core/cli.drush.inc
Command callback.

File

commands/core/cli.drush.inc, line 153

Code

function drush_history_path_cli() {
  $cli_directory = drush_directory_cache('cli');

  // If only the Drupal version is being used for the history.
  if (drush_get_option('version-history', FALSE)) {
    $drupal_major_version = drush_drupal_major_version();
    $file_name = "drupal-$drupal_major_version";
  }
  // If there is an alias, use that in the site specific name. Otherwise,
  // use a hash of the root path.
  else {
    if ($alias = drush_get_context('DRUSH_TARGET_SITE_ALIAS')) {
      $site = drush_sitealias_get_record($alias);
      $site_suffix = $site['#name'];
    }
    else {
      $site_suffix = md5(DRUPAL_ROOT);
    }

    $file_name = "drupal-site-$site_suffix";
  }

  $full_path = "$cli_directory/$file_name";

  // Output the history path if verbose is enabled.
  if (drush_get_context('DRUSH_VERBOSE')) {
    drush_log(dt('History: @full_path', ['@full_path' $full_path]), LogLevel::INFO);
  }

  return $full_path;
}