Skip to content

Commit

Permalink
Merge branch '9.0' into feature/4289-overhaul-catchup
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Aug 25, 2023
2 parents 21e3ffd + 047806b commit c771055
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 98 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,103 +15,6 @@ class ContentStreamCommandController extends CommandController
*/
protected $contentRepositoryRegistry;

/**
* @throws \Neos\Flow\Cli\Exception\StopCommandException
*/
public function exportCommand(string $contentStream, string $contentRepository = 'default', int $startSequenceNumber = 0): void
{
$contentRepositoryId = ContentRepositoryId::fromString($contentRepository);
throw new \RuntimeException('TODO IMPL??');
// TODO??$events = $this->contentRepositoryEventStore->load(
// StreamName::fromString($contentStream),
// $startSequenceNumber
//);
}

/**
* 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<body>
<trans-unit id="ui.label" xml:space="preserve">
<source>Content Collection</source>
<target state="translated">Recopilación de los contenidos</target>
<target state="translated">Colección de contenidos</target>
</trans-unit>
</body>
</file>
Expand Down

0 comments on commit c771055

Please sign in to comment.