You are here

public function AcsfDuplicationCommands::duplicationScrubProgress in Acquia Cloud Site Factory Connector 8.2

Returns information about the progress of the batch scrubbing process.

@command acsf-duplication-scrub-progress

Return value

\Consolidation\OutputFormatters\StructuredData\PropertyList Description of remaining comments to scrub.

Throws

\Drupal\acsf\AcsfException If the scrub process was not successful or the acsf module is not enabled.

\InvalidArgumentException If one or more arguments are missing.

File

acsf_duplication/src/Commands/AcsfDuplicationCommands.php, line 113

Class

AcsfDuplicationCommands
Provides drush commands necessary for site duplication.

Namespace

Drupal\acsf_duplication\Commands

Code

public function duplicationScrubProgress() {
  if (!\Drupal::moduleHandler()
    ->moduleExists('acsf')) {
    throw new AcsfException(dt('The ACSF module must be enabled.'));
  }

  // Get the remaining count from the handlers. (Note this code highlights the
  // fact that the countRemaining() method does not return different results
  // depending on whether we pass in a proper event/context; if it does, we
  // will return bogus results.)
  $empty_event = AcsfEvent::create('site_duplication_scrub', [], $this
    ->output());
  $data = [];
  $handler = new AcsfDuplicationScrubCommentHandler($empty_event);
  $data['comment_count'] = $handler
    ->countRemaining();
  $handler = new AcsfDuplicationScrubNodeHandler($empty_event);
  $data['node_count'] = $handler
    ->countRemaining();
  $handler = new AcsfDuplicationScrubUserHandler($empty_event);
  $data['user_count'] = $handler
    ->countRemaining();
  \Drupal::moduleHandler()
    ->alter('acsf_duplication_scrub_remaining_counts', $data);
  return new PropertyList($data);
}