/** * Export sites content * * This command exports all or one specific site with all its content into an XML format. * * If the package key option is given, the site(s) will be exported to the given package in the default * location Resources/Private/Content/Sites.xml. * * If the filename option is given, any resources will be exported to files in a folder named "Resources" * alongside the XML file. * * If neither the filename nor the package key option are given, the XML will be printed to standard output and * assets will be embedded into the XML in base64 encoded form. * * @param string $siteNode the node name of the site to be exported; if none given will export all sites * @param boolean $tidy Whether to export formatted XML * @param string $filename relative path and filename to the XML file to create. Any resource will be stored in a sub folder "Resources". * @param string $packageKey Package to store the XML file in. Any resource will be stored in a sub folder "Resources". * @param string $nodeTypeFilter Filter the node type of the nodes, allows complex expressions (e.g. "TYPO3.Neos:Page", "!TYPO3.Neos:Page,TYPO3.Neos:Text") * @return void */ public function exportCommand($siteNode = null, $tidy = false, $filename = null, $packageKey = null, $nodeTypeFilter = null) { if ($siteNode === null) { $sites = $this->siteRepository->findAll()->toArray(); } else { $sites = $this->siteRepository->findByNodeName($siteNode)->toArray(); } if (count($sites) === 0) { $this->outputLine('Error: No site for exporting found'); $this->quit(1); } if ($packageKey !== null) { $this->siteExportService->exportToPackage($sites, $tidy, $packageKey, $nodeTypeFilter); if ($siteNode !== null) { $this->outputLine('The site "%s" has been exported to package "%s".', array($siteNode, $packageKey)); } else { $this->outputLine('All sites have been exported to package "%s".', array($packageKey)); } } elseif ($filename !== null) { $this->siteExportService->exportToFile($sites, $tidy, $filename, $nodeTypeFilter); if ($siteNode !== null) { $this->outputLine('The site "%s" has been exported to "%s".', array($siteNode, $filename)); } else { $this->outputLine('All sites have been exported to "%s".', array($filename)); } } else { $this->output($this->siteExportService->export($sites, $tidy, $nodeTypeFilter)); } }