Skip to content

Commit

Permalink
Remove contentstream:import CLI command, too
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Aug 1, 2023
1 parent b9e5405 commit 81e4157
Showing 1 changed file with 0 additions and 84 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,90 +15,6 @@ class ContentStreamCommandController extends CommandController
*/
protected $contentRepositoryRegistry;

/**
* Imports events to a content stream from the given file.
* Note that the events in the file need to come from the same content stream you import to for now!
*
* @throws \Neos\ContentRepository\Core\SharedModel\Exception\ContentStreamAlreadyExists
* @throws \Neos\ContentRepository\Core\Feature\WorkspaceCreation\Exception\WorkspaceAlreadyExists
* @throws \Neos\EventSourcing\EventListener\Exception\EventCouldNotBeAppliedException
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
*/
public function importCommand(string $contentStream, string $file = null): void
{
throw new \RuntimeException('TODO IMPL??');
// TODO
// if ($file !== null) {
// $fileStream = fopen($file, 'r');
// $this->outputLine('Reading from file: "%s"', [$file]);
// } else {
// $fileStream = fopen('php://stdin', 'r');
// $this->outputLine('Reading import data from standard in.');
// }
// if (!$fileStream) {
// throw new \InvalidArgumentException('Failed to open file ' . $file);
// }
// $normalizer = new EventNormalizer(new EventTypeResolver());
//
// $contentStreamToImportTo = ContentStreamId::fromString($contentStream);
// $eventStreamName = ContentStreamEventStreamName::fromContentStreamId($contentStreamToImportTo)
// ->getEventStreamName();
//
// $this->outputLine('Clearing workspace projection to create the workspace to import to.');
// $workspaceProjection = $this->projectionManager->getProjection('workspace');
// $this->projectionManager->replay($workspaceProjection->getIdentifier());
//
// $commandResult = $this->workspaceCommandHandler->handleCreateRootWorkspace(
// new CreateRootWorkspace(
// WorkspaceName::forLive(),
// WorkspaceTitle::fromString('Live'),
// WorkspaceDescription::fromString(''),
// UserIdentifier::forSystemUser(),
// $contentStreamToImportTo
// )
// );
//
// $this->outputLine('Created workspace "Live" for the given content stream identifier');
//
// $i = 0;
// $domainEvents = DomainEvents::createEmpty();
//
// $this->outputLine('starting import');
// $this->output->progressStart();
// for ($line = fgets($fileStream); $line !== false; $line = fgets($fileStream)) {
// $this->output->progressAdvance();
// $i++;
// if ($line === '[' || $line === ']') {
// continue;
// }
//
// $rawEventLine = ltrim($line, ',');
// $rawEventProperties = json_decode($rawEventLine, true);
// if (!is_array($rawEventProperties)) {
// continue;
// }
//
// $domainEvent = $normalizer->denormalize($rawEventProperties['payload'], $rawEventProperties['type']);
// $domainEvent = DecoratedEvent::addMetadata($domainEvent, $rawEventProperties['metadata']);
//
// $domainEvents = $domainEvents->appendEvent($domainEvent);
//
// if ($i === 10) {
// $this->contentRepositoryEventStore->commit($eventStreamName, $domainEvents);
// $domainEvents = DomainEvents::createEmpty();
// $i = 0;
// }
// }
// $this->output->progressFinish();
//
// $this->contentRepositoryEventStore->commit($eventStreamName, $domainEvents);
// fclose($fileStream);
// $this->outputLine('');
// $this->outputLine('Finished importing events.');
// $this->outputLine('Your events and projections are probably out of sync now,'
// . ' <error>make sure you replay all projections via "./flow projection:replayall"</error>.');
}

/**
* Remove all content streams which are not needed anymore from the projections.
*
Expand Down

0 comments on commit 81e4157

Please sign in to comment.