You are here

public function AcquiaSearchCommands::searchSolrCoresPreferred in Acquia Search 3.x

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

Display preferred Acquia search core.

@command acquia:search-solr:cores:preferred @aliases acquia:ss:cores:preferred

@usage acquia:search-solr:cores:preferred Display preferred Acquia search core. @usage acquia:ss:cores:preferred Display preferred Acquia search core.

@validate-module-enabled acquia_search

Throws

\Exception In case if no preferred search core available.

File

src/Commands/AcquiaSearchCommands.php, line 218

Class

AcquiaSearchCommands
A Drush commandfile.

Namespace

Drupal\acquia_search\Commands

Code

public function searchSolrCoresPreferred() {
  if (!($preferred_core = Runtime::getPreferredSearchCoreService()
    ->getPreferredCore())) {
    throw new \Exception('No preferred search core available');
  }
  $this
    ->output()
    ->writeln($preferred_core['core_id']);
}