public function EntityShareClientCliService::ioPullUpdates in Entity Share 8.2
Same name and namespace in other branches
- 8 modules/entity_share_client/src/Service/EntityShareClientCliService.php \Drupal\entity_share_client\Service\EntityShareClientCliService::ioPullUpdates()
Handle the pull updates interaction.
Parameters
string $remote_id: The remote website id to import from.
string $channel_id: The remote channel id to import.
\Symfony\Component\Console\Style\StyleInterface|\ConfigSplitDrush8Io $io: The $io interface of the cli tool calling.
callable $t: The translation function akin to t().
File
- modules/
entity_share_client/ src/ Service/ EntityShareClientCliService.php, line 170
Class
- EntityShareClientCliService
- Class EntityShareClientCliService.
Namespace
Drupal\entity_share_client\ServiceCode
public function ioPullUpdates($remote_id, $channel_id, $io, callable $t) {
Timer::start('io-pull-updates');
/** @var \Drupal\entity_share_client\Entity\RemoteInterface $remotes */
$remotes = Remote::loadMultiple();
// Check that the remote website exists.
if (!isset($remotes[$remote_id])) {
$io
->error($t('There is no remote website configured with the id: @remote_id.', [
'@remote_id' => $remote_id,
]));
return;
}
$remote = $remotes[$remote_id];
$channel_infos = $this->remoteManager
->getChannelsInfos($remote);
// Check that the channel exists.
if (!isset($channel_infos[$channel_id])) {
$io
->error($t('There is no channel configured or accessible with the id: @channel_id.', [
'@channel_id' => $channel_id,
]));
return;
}
$update_count = $this
->pullUpdates($remote, $channel_infos[$channel_id]['url'], $channel_infos[$channel_id]['url_uuid'], $channel_infos[$channel_id]['channel_entity_type']);
Timer::stop('io-pull-updates');
$io
->success($t('Channel successfully pulled. Number of updated entities: @count, execution time: @time ms', [
'@count' => $update_count,
'@time' => Timer::read('io-pull-updates'),
]));
}