You are here

public function CliService::sync_core_login in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 src/Cli/CliService.php \Drupal\cms_content_sync\Cli\CliService::sync_core_login()
  2. 2.1.x src/Cli/CliService.php \Drupal\cms_content_sync\Cli\CliService::sync_core_login()

Kindly ask the Sync Core to login again.

Parameters

ICLIIO $io: The CLI service which allows interoperability

Throws

\EdgeBox\SyncCore\Exception\SyncCoreException

File

src/Cli/CliService.php, line 77

Class

CliService

Namespace

Drupal\cms_content_sync\Cli

Code

public function sync_core_login($io) {
  $io
    ->text('Asking all connected Sync Cores to refresh the login to this site...');
  $io
    ->text('Please note that this only works for old v1 Sync Cores.');
  $cores = SyncCoreFactory::getAllSyncCores();
  foreach ($cores as $host => $core) {
    if ($core
      ->getSyndicationService()
      ->refreshAuthentication()) {
      $io
        ->text('SUCCESS login from Sync Core at ' . $host);
    }
    else {
      $io
        ->error('FAILED to login from Sync Core at ' . $host);
    }
  }
  $io
    ->success('Done.');
}