Skip to content

Commit

Permalink
Disentangle harvest register and revert (#3958)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-korn authored Oct 6, 2023
1 parent b6a65d8 commit 9c8af73
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
10 changes: 7 additions & 3 deletions modules/harvest/src/Commands/HarvestCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Drupal\harvest\Load\Dataset;
use Drupal\harvest\HarvestService;
use Drush\Commands\DrushCommands;
use Drush\Exceptions\UserAbortException;
use Harvest\ETL\Extract\DataJson;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\ConsoleOutput;
Expand Down Expand Up @@ -127,13 +128,16 @@ protected function buildPlanFromOpts($opts) {
*/
public function deregister($id) {
$message = 'Could not deregister the ' . $id . ' harvest.';
try {
$this->logger->warning(
'If you deregister a harvest with published datasets, you will
not be able to bulk revert the datasets connected to this harvest.');
if ($this->io()->confirm("Deregister harvest {$id}")) {
if ($this->harvestService->deregisterHarvest($id)) {
$message = 'Successfully deregistered the ' . $id . ' harvest.';
}
}
catch (\Exception $e) {
$message = $e->getMessage();
else {
throw new UserAbortException();
}

$this->logger->notice($message);
Expand Down
5 changes: 0 additions & 5 deletions modules/harvest/src/HarvestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,6 @@ public function registerHarvest($plan) {
* Boolean.
*/
public function deregisterHarvest(string $id) {
try {
$this->revertHarvest($id);
}
catch (\Exception $e) {
}

$plan_store = $this->storeFactory->getInstance("harvest_plans");

Expand Down

0 comments on commit 9c8af73

Please sign in to comment.