Skip to content

Commit

Permalink
minor update
Browse files Browse the repository at this point in the history
  • Loading branch information
barw4 committed Jan 12, 2022
1 parent ca93f00 commit e61aed4
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/bundle/Command/PageFieldTypeCleanupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,29 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$limit = (int) $helper->ask($input, $output, $question);

$count = $this->countOrphanedPageRelations();

if ($count) {
$this->deleteOrphanedPageRelations($limit);
}
$this->countOrphanedPageRelations();
$this->deleteOrphanedPageRelations($limit);

$this->io->success('Done');

return 0;
}

private function countOrphanedPageRelations(): int
private function countOrphanedPageRelations(): void
{
$count = $this->gateway->countOrphanedPageRelations();

$count <= 0
? $this->io->success('Found: 0')
: $this->io->caution(sprintf('Found: %d orphaned pages', $count));

return $count;
}

private function deleteOrphanedPageRelations(int $limit): void
{
if (!$this->io->confirm(
sprintf('Are you sure that you want to proceed? The maximum number of pages that will be cleaned
in this iteration is equal to %d.', $limit),
in this iteration is equal to %d. If the number is equal to 0 you can still continue to run the remaining
cleaning methods.', $limit),
false)
) {
return;
Expand Down

0 comments on commit e61aed4

Please sign in to comment.