setName('mautic:iplookup:download')
->setHelp(
<<<'EOT'
The %command.name% command is used to update local IP lookup data if applicable.
php %command.full_name%
EOT
);
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
if ($this->ipService instanceof AbstractLocalDataLookup) {
if ($this->ipService->downloadRemoteDataStore()) {
$output->writeln(''.$this->translator->trans('mautic.core.success').'');
} else {
$remoteUrl = $this->ipService->getRemoteDateStoreDownloadUrl();
$localPath = $this->ipService->getLocalDataStoreFilepath();
if ($remoteUrl && $localPath) {
$output->writeln(''.$this->translator->trans(
'mautic.core.ip_lookup.remote_fetch_error',
[
'%remoteUrl%' => $remoteUrl,
'%localPath%' => $localPath,
]
).'');
} else {
$output->writeln(''.$this->translator->trans(
'mautic.core.ip_lookup.remote_fetch_error_generic'
).'');
}
}
}
return Command::SUCCESS;
}
protected static $defaultDescription = 'Fetch remote datastores for IP lookup services that leverage local lookups';
}