Skip to content

Commit

Permalink
Fix dkan:harvest:deregister message (#3974)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-m committed Jun 6, 2023
1 parent 0951aed commit 98ff407
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions modules/harvest/src/Commands/HarvestCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function register(string $plan_json = '', array $opts = [
try {
$plan = $plan_json ? json_decode($plan_json) : $this->buildPlanFromOpts($opts);
$identifier = $this->harvestService->registerHarvest($plan);
$this->logger->notice("Successfully registered the {$identifier} harvest.");
$this->logger->notice('Successfully registered the ' . $identifier . ' harvest.');
}
catch (\Exception $e) {
$this->logger->error($e->getMessage());
Expand Down Expand Up @@ -126,19 +126,17 @@ protected function buildPlanFromOpts($opts) {
* @command dkan:harvest:deregister
*/
public function deregister($id) {
$message = 'Could not deregister the ' . $id . ' harvest.';
try {
if ($this->harvestService->deregisterHarvest($id)) {
$message = "Successfully deregistered the {$id} harvest.";
}
else {
$message = "No harvest {$id} deregistered. Check if it exists.";
$message = 'Successfully deregistered the ' . $id . ' harvest.';
}
}
catch (\Exception $e) {
$message = $e->getMessage();
}

(new ConsoleOutput())->write($message . PHP_EOL);
$this->logger->notice($message);
}

/**
Expand Down Expand Up @@ -333,11 +331,11 @@ public function orphanDatasets(string $harvestId) : int {
try {
$orphans = $this->harvestService->getOrphanIdsFromCompleteHarvest($harvestId);
$this->harvestService->processOrphanIds($orphans);
$this->logger()->notice("Orphaned ids from harvest {$harvestId}: " . implode(", ", $orphans));
$this->logger()->notice("Orphaned ids from harvest {$harvestId}: " . implode(', ', $orphans));
return DrushCommands::EXIT_SUCCESS;
}
catch (\Exception $e) {
$this->logger()->error("Error in orphaning datasets of harvest %harvest: %error", [
$this->logger()->error('Error in orphaning datasets of harvest %harvest: %error', [
'%harvest' => $harvestId,
'%error' => $e->getMessage(),
]);
Expand Down

0 comments on commit 98ff407

Please sign in to comment.