/** * Returns the node of the current site. * * @return NodeInterface */ public function getCurrentSiteNode() { if ($this->currentSite !== null && $this->currentSiteNode === null) { $siteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $this->currentSite->getNodeName()); $this->currentSiteNode = $this->getNode($siteNodePath); if (!$this->currentSiteNode instanceof NodeInterface) { $this->systemLogger->log(sprintf('Warning: %s::getCurrentSiteNode() couldn\'t load the site node for path "%s" in workspace "%s". This is probably due to a missing baseworkspace for the workspace of the current user.', __CLASS__, $siteNodePath, $this->workspaceName), LOG_WARNING); } } return $this->currentSiteNode; }
/** * Returns the node of the current site. * * @return NodeInterface */ public function getCurrentSiteNode() { if ($this->currentSite !== NULL && $this->currentSiteNode === NULL) { $siteNodePath = '/sites/' . $this->currentSite->getNodeName(); $this->currentSiteNode = $this->getNode($siteNodePath); if (!$this->currentSiteNode instanceof NodeInterface) { $this->systemLogger->log(sprintf('Warning: %s::getCurrentSiteNode() couldn\'t load the site node for path "%s" in workspace "%s". This is probably due to a missing baseworkspace for the workspace of the current user.', __CLASS__, $siteNodePath, $this->workspaceName), LOG_WARNING); } } return $this->currentSiteNode; }
/** * Remove given site all nodes for that site and all domains associated. * * @param Site $site * @return void */ public function pruneSite(Site $site) { $siteNodePath = '/sites/' . $site->getNodeName(); $this->nodeDataRepository->removeAllInPath($siteNodePath); $siteNodes = $this->nodeDataRepository->findByPath($siteNodePath); foreach ($siteNodes as $siteNode) { $this->nodeDataRepository->remove($siteNode); } $domainsForSite = $this->domainRepository->findBySite($site); foreach ($domainsForSite as $domain) { $this->domainRepository->remove($domain); } $this->siteRepository->remove($site); $this->emitSitePruned($site); }
/** * Remove given site all nodes for that site and all domains associated. * * @param Site $site * @return void */ public function pruneSite(Site $site) { $siteNodePath = NodePaths::addNodePathSegment(static::SITES_ROOT_PATH, $site->getNodeName()); $this->nodeDataRepository->removeAllInPath($siteNodePath); $siteNodes = $this->nodeDataRepository->findByPath($siteNodePath); foreach ($siteNodes as $siteNode) { $this->nodeDataRepository->remove($siteNode); } $domainsForSite = $this->domainRepository->findBySite($site); foreach ($domainsForSite as $domain) { $this->domainRepository->remove($domain); } $this->siteRepository->remove($site); $this->emitSitePruned($site); }
/** * Update a site * * @param Site $site A site to update * @param string $newSiteNodeName A new site node name * @return void * @Flow\Validate(argumentName="$site", type="UniqueEntity") * @Flow\Validate(argumentName="$newSiteNodeName", type="NotEmpty") * @Flow\Validate(argumentName="$newSiteNodeName", type="StringLength", options={ "minimum"=1, "maximum"=250 }) * @Flow\Validate(argumentName="$newSiteNodeName", type="TYPO3.Neos:NodeName") */ public function updateSiteAction(Site $site, $newSiteNodeName) { if ($site->getNodeName() !== $newSiteNodeName) { $oldSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $site->getNodeName()); $newSiteNodePath = NodePaths::addNodePathSegment(SiteService::SITES_ROOT_PATH, $newSiteNodeName); /** @var $workspace Workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace); if ($siteNode !== null) { $siteNode->setPath($newSiteNodePath); } } $site->setNodeName($newSiteNodeName); $this->nodeDataRepository->persistEntities(); } $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been updated.', 'Update', null, array(htmlspecialchars($site->getName())), 1412371798); $this->unsetLastVisitedNodeAndRedirect('index'); }
/** * Update a site * * @param Site $site A site to update * @param string $newSiteNodeName A new site node name * @return void * @Flow\Validate(argumentName="$site", type="UniqueEntity") * @Flow\Validate(argumentName="$newSiteNodeName", type="NotEmpty") * @Flow\Validate(argumentName="$newSiteNodeName", type="StringLength", options={ "minimum"=1, "maximum"=250 }) * @Flow\Validate(argumentName="$newSiteNodeName", type="TYPO3.Neos:NodeName") */ public function updateSiteAction(Site $site, $newSiteNodeName) { if ($site->getNodeName() !== $newSiteNodeName) { $oldSiteNodePath = '/sites/' . $site->getNodeName(); $newSiteNodePath = '/sites/' . $newSiteNodeName; /** @var $workspace Workspace */ foreach ($this->workspaceRepository->findAll() as $workspace) { $siteNode = $this->nodeDataRepository->findOneByPath($oldSiteNodePath, $workspace); if ($siteNode !== NULL) { $siteNode->setPath($newSiteNodePath); } } $site->setNodeName($newSiteNodeName); $this->nodeDataRepository->persistEntities(); } $this->siteRepository->update($site); $this->addFlashMessage('The site "%s" has been updated.', 'Update', NULL, array($site->getName()), 1412371798); $this->unsetLastVisitedNodeAndRedirect('index'); }