protected function AcquiaContentHubPublisherAuditEntityCommands::showAuditResults in Acquia Content Hub 8.2
Presents Results of the Audit and actions to take.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: The entity to audit.
\Acquia\ContentHubClient\CDF\CDFObject $cdf: The CDF Object.
array $dependencies: The list of entity dependencies.
string $origin: The origin UUID.
string $remote_origin: The remote origin UUID.
Return value
bool The drush return.
Throws
\Exception
1 call to AcquiaContentHubPublisherAuditEntityCommands::showAuditResults()
- AcquiaContentHubPublisherAuditEntityCommands::auditEntity in modules/
acquia_contenthub_publisher/ src/ Commands/ AcquiaContentHubPublisherAuditEntityCommands.php - Audits an entity for differences with existing CDF in Acquia Content Hub.
File
- modules/
acquia_contenthub_publisher/ src/ Commands/ AcquiaContentHubPublisherAuditEntityCommands.php, line 522
Class
- AcquiaContentHubPublisherAuditEntityCommands
- Drush commands for Acquia Content Hub Publishers Audit Entity.
Namespace
Drupal\acquia_contenthub_publisher\CommandsCode
protected function showAuditResults(EntityInterface $entity, CDFObject $cdf, array $dependencies, string $origin, string $remote_origin) : bool {
$this->output
->writeln('');
$this->output
->writeln('Results from the Audit:');
$this->output
->writeln('');
if ($this
->getResult(self::WEBHOOK_CHECK)) {
$this->output
->writeln('<comment>* Possible Webhook Issue</comment>:');
$this->output
->writeln('We detected that the entity did not have a <info>CONFIRMED</info> status. This could be caused by the site not receiving webhooks correctly.');
$this->output
->writeln('Make sure the site is able to receive webhooks by checking that:');
$this->output
->writeln(' - The Webhook URL is not suppressed.');
$this->output
->writeln(' - A mis-configured "shield" module could be blocking the reception of webhooks.');
$this->output
->writeln(' - An .htaccess apache redirect rule could be blocking the reception of webhooks.');
$this->output
->writeln(' - A CDN rule could be preventing the site to receive webhooks.');
$this->output
->writeln(' - etc. There are unlimited possible cases.');
$this->output
->writeln('You can tell that the issue is solved if you see log strings starting with "Webhook landing" in the Drupal Watchdog.');
$this->output
->writeln('');
}
if ($this
->getResult(self::RE_ORIGINATE)) {
$this->output
->writeln('<error>* Client site ORIGIN does not match published Entity ORIGIN:</error>');
$this->output
->writeln(sprintf('You are trying to publish an entity with an origin (%s) that does not have ownership over the entity with UUID = "%s" (origin = "%s")', $origin, $cdf
->getUuid(), $remote_origin));
$this->output
->writeln('Are you sure you are in the correct site?")');
$owner = $this->client
->getEntity($remote_origin);
if ($owner instanceof CDFObjectInterface) {
$webhook = $owner
->getWebhook();
$domain = $webhook['settings_url'] ?? '';
$client_name = $owner
->getClientName()
->getValue()['und'];
$this->output
->writeln(sprintf('The client that has ownership of this content is: "%s" (%s).', $client_name, $domain));
$this->output
->writeln('');
}
else {
$clients = $this->client
->getClients();
$origins = array_column($clients, 'name', 'uuid');
if (isset($origins[$remote_origin])) {
$this->output
->writeln(sprintf('The client that has ownership of this content is: "%s".', $origins[$remote_origin]));
$this->output
->writeln('');
}
else {
$this->output
->writeln('The client that has ownership of this content does not seem to exist anymore in this subscription.');
$this->output
->writeln('<error>You cannot Export this content from this Publisher.</error>');
$this->output
->writeln('');
}
}
$this->output
->writeln('In order to fix this issue you can:');
$this->output
->writeln(' - Find the Site Origin where this content was originally published and run this command from there.');
$this->output
->writeln(' - If the original publisher origin still exist you can re-originate this content to the new publisher.');
$this->output
->writeln(' - If the original publisher origin does not exist anymore, you could purge the subscription and republish all content.');
$this->output
->writeln('');
return TRUE;
}
// If the entity needs to be re-exported.
if ($this
->getResult(self::NEEDS_REEXPORT)) {
$this->output
->writeln('<error>* Entity needs to be re-exported</error>:');
$this->output
->writeln('The diagnostic shows that to fix the highlighted issues you need to re-export this content.');
$this->output
->writeln('');
if ($this
->io()
->confirm('Do you want to re-export this entity and all it\'s dependencies?')) {
$this
->reExportEntity($entity, $dependencies);
}
}
else {
$this->output
->writeln('Entity does not need to be re-exported.');
$this->output
->writeln('');
}
$this->output
->writeln('Task completed.');
return TRUE;
}