You are here

public function AcquiaSearchCommands::searchSolrResetCoresCache in Acquia Search 2.x

Same name and namespace in other branches
  1. 3.x src/Commands/AcquiaSearchCommands.php \Drupal\acquia_search\Commands\AcquiaSearchCommands::searchSolrResetCoresCache()

Resets the Acquia Solr Search cores cache.

By identifier provided either by configuration or by argument.

@command acquia:search-solr:cores:cache-reset

@aliases acquia:ss:cores:cr

@usage acquia:search-solr:cores:cache-reset Clears the Acquia search cores cache for the default Acquia subscription identifier provided by module configuration.

@validate-module-enabled acquia_search

Throws

\Exception In case of the invalid Acquia subscription identifier provided via id option or stored in the module configuration.

File

src/Commands/AcquiaSearchCommands.php, line 124

Class

AcquiaSearchCommands
A Drush commandfile.

Namespace

Drupal\acquia_search\Commands

Code

public function searchSolrResetCoresCache() {
  if (\Drupal::state()
    ->get('acquia_subscription_data')) {
    $sub = new Subscription();
    $sub
      ->update();
    $this
      ->output()
      ->writeln(dt('Refreshed list of cores from Acquia Connector subscription data.'));
  }
  $search_v3_enabled = \Drupal::config('acquia_search.settings')
    ->get('search_v3_enabled');
  if ($search_v3_enabled) {
    $cid = sprintf("acquia_search.v3indexes");
    if ($this->cache
      ->get($cid)) {
      $this->cache
        ->delete($cid);
      $this
        ->output()
        ->writeln(dt('Cleared list of cores from acquia_search.v3indexes cache.'));
    }
  }
}