Set current site

@param string $siteId
@param string $siteName
@param string $siteDefaultLanguage
@param array $languages
@deprecated use OpenOrchestra\Backoffice\Context\ContextBackOfficeManager::setSite
193358
public function setCurrentSite($siteId, $siteName, $siteDefaultLanguage, array $languages)
    {
        parent::setSite($siteId, $siteName, $siteDefaultLanguage, $languages);
    }
1023917
public function copySiteById(
        $siteId,
        string $createdByUserId,
        string $createdReason = Tracking::UNKNOWN_REASON
    ) {
        /** @var \Rcm\Entity\Site $site */
        $existingSite = $this->find($siteId);

        if (empty($existingSite)) {
            throw new SiteNotFoundException("Site {$siteId} not found.");
        }

        $site = $existingSite->newInstance(
            $createdByUserId,
            $createdReason
        );

        return $site;
    }
1295886
public static function getByLanguage($language, Site $site = null)
    {
        if (!$site) {
            $site = \Core::make('site')->getSite();
        }

        $em = Database::get()->getEntityManager();
        /**
         * @var $section Locale
         */
        $section = $em->getRepository('Concrete\Core\Entity\Site\Locale')
            ->findOneBy(['site' => $site, 'msLanguage' => $language]);

        if (is_object($section)) {
            $obj = parent::getByID($section->getSiteTree()->getSiteHomePageID(), 'RECENT');
            $obj->setLocale($section);

            return $obj;
        }

        return false;
    }
367124
private function LoadFrontendTranslations(Site $site)
    {
        $language = $site->GetLanguage()->GetCode();
        $frontendTranslations = PathUtil::FrontendBundleTranslationFile($this->BundleName(), $language);
        if (File::Exists($frontendTranslations))
        {
            require_once $frontendTranslations;
        }
        
    }
46418
public function set( SiteLink $siteLink, $target, EditInfo $editInfo = null ) {
		$this->throwExceptionsOnBadTarget( $target );

		$params = $this->getTargetParamsFromTarget(
			$this->getEntityIdentifierFromTarget( $target )
		);

		$params['linksite'] = $siteLink->getSiteId();
		$params['linktitle'] = $siteLink->getPageName();
		$params['badges'] = implode( '|', $siteLink->getBadges() );

		$this->api->postRequest( 'wbsetsitelink', $params, $editInfo );
		return true;
	}
79444
protected function _setLocale( $site )
	{
		$context = $this->_getContext();
		$locale = $context->getLocale();

		$siteItem = null;
		$siteManager = MShop_Locale_Manager_Factory::createManager( $context )->getSubManager( 'site' );

		if( $site != '' )
		{
			$search = $siteManager->createSearch();
			$search->setConditions( $search->compare( '==', 'locale.site.code', $site ) );
			$sites = $siteManager->searchItems( $search );

			if ( ( $siteItem = reset( $sites ) ) === false ) {
				throw new Controller_ExtJS_Exception( 'Site item not found.' );
			}
		}

		$localeItem = new MShop_Locale_Item_Default( array(), $siteItem );
		$localeItem->setLanguageId( $locale->getLanguageId() );
		$localeItem->setCurrencyId( $locale->getCurrencyId() );

		if( $siteItem !== null ) {
			$localeItem->setSiteId( $siteItem->getId() );
		}

		$context->setLocale( $localeItem );
	}
583886
public function update($siteId, $data)
    {
        //ACCESS CHECK
        if (!$this->isAllowed(
            ResourceName::RESOURCE_SITES,
            'admin'
        )
        ) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        if (!is_array($data)) {
            throw new \Exception('Invalid data format');
        }

        /** @var \Doctrine\ORM\EntityManager $entityManager */
        $entityManager = $this->getEntityManager();

        /** @var \Rcm\Repository\Site $siteRepo */
        $siteRepo = $entityManager->getRepository(\Rcm\Entity\Site::class);

        if (!$siteRepo->isValidSiteId($siteId)) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_400);

            return $this->getResponse();
        }

        /** @var \Rcm\Entity\Site $site */
        $site = $siteRepo->findOneBy(['siteId' => $siteId]);

        $newStatus = $site->getStatus();

        if ($data['status'] == 'D') {
            $newStatus = 'D';
        }
        if ($data['status'] == 'A') {
            $newStatus = 'A';
        }

        $site->setStatus($newStatus);

        $site->setModifiedByUserId(
            $this->getCurrentUserId(),
            "Update site status to {$newStatus} in " . get_class($this)
        );

        $entityManager->persist($site);
        $entityManager->flush($site);

        $this->siteVersionRepo->publish(
            new SiteLocator($site->getDomainName()),
            $this->getSiteManager()->siteToImmutableSiteContent($site),
            $this->getCurrentUserTracking()->getId(),
            __CLASS__ . '::' . __FUNCTION__,
            $site->getSiteId()
        );

        return new JsonModel($site);
    }
188292
public function setSite(Site $site)
    {
        if ($this->site || $site->getId() !== $this->getSiteId()) {
            throw new \LogicException("this object is not really immutable, but it should be, site is already set anyway");
        }

        $this->site = $site;
    }
966092
public function setupCommand($siteNodeName)
    {
        $assetCollectionTitle = ucfirst($siteNodeName);
        $assetCollection = $this->assetCollectionRepository->findOneByTitle($assetCollectionTitle);

        if ($assetCollection === null) {
            $assetCollection = new AssetCollection($assetCollectionTitle);
            $this->assetCollectionRepository->add($assetCollection);
        }

        /** @var Site $site */
        $site = $this->siteRepository->findOneByNodeName($siteNodeName);
        $site->setAssetCollection($assetCollection);
        $this->siteRepository->update($site);

        $this->outputLine('Site has been set up.');
    }
200325
protected function buildSitemap($rootPageId, $languageId)
    {
        if ($languageId !== null) {
            // Language lock enabled
            $rootPageLinkTemplate = 'sitemap-r%s-l%s-p###PAGE###.xml.gz';
            $sitemapIndexFileName = 'index-r%s-l%s.xml.gz';
            $sitemapPageFileName  = 'sitemap-r%s-l%s-p%s.xml.gz';
        } else {
            $rootPageLinkTemplate = 'sitemap-r%s-p###PAGE###.xml.gz';
            $sitemapIndexFileName = 'index-r%s.xml.gz';
            $sitemapPageFileName  = 'sitemap-r%s-p%3$s.xml.gz';
        }

        // Init builder
        $generator = $this->objectManager->get('Metaseo\\Metaseo\\Sitemap\\Generator\\XmlGenerator');
        $fileName  = sprintf($rootPageLinkTemplate, $rootPageId, $languageId);

        $generator->indexPathTemplate = $this->generateSitemapLinkTemplate($fileName);

        // Get list of pages
        $pageCount = $generator->pageCount();

        // Index
        $content  = $generator->sitemapIndex();
        $fileName = sprintf($sitemapIndexFileName, $rootPageId, $languageId);
        $this->writeToFile(PATH_site . '/' . $this->sitemapDir . '/' . $fileName, $content);

        // Page
        for ($i = 0; $i < $pageCount; $i++) {
            $content  = $generator->sitemap($i);
            $fileName = sprintf($sitemapPageFileName, $rootPageId, $languageId, $i);
            $this->writeToFile(PATH_site . '/' . $this->sitemapDir . '/' . $fileName, $content);
        }

        return true;
    }
509850
protected function setSites(InputInterface $input)
    {
        $sites = SiteTable::query()
            ->setFilter([
                'LID' => $input->getArgument('sites'),
            ])
            ->setSelect(['LID'])
            ->exec();

        if ($sites->getSelectedRowsCount() <= 0) {
            $this->errors[] = 'Sites not found';
        }

        $this->sites = $sites->fetchAll();
    }
950969
private void siteSelected(String site) {
		if (!site.equals(currentSite)) {
			this.sessionsModel = extension.getHttpSessionsSite(site).getModel();
			this.getHttpSessionsTable().setModel(this.sessionsModel);

			this.setSessionsTableColumnSizes();

			currentSite = site;
		}
	}
564485
protected function exportSite(Site $site, $nodeTypeFilter)
    {
        /** @var ContentContext $contentContext */
        $contentContext = $this->contextFactory->create([
            'currentSite' => $site,
            'invisibleContentShown' => true,
            'inaccessibleContentShown' => true
        ]);

        $siteNode = $contentContext->getCurrentSiteNode();

        $this->xmlWriter->startElement('site');
        $this->xmlWriter->writeAttribute('name', $site->getName());
        $this->xmlWriter->writeAttribute('state', $site->getState());
        $this->xmlWriter->writeAttribute('siteResourcesPackageKey', $site->getSiteResourcesPackageKey());
        $this->xmlWriter->writeAttribute('siteNodeName', $siteNode->getName());

        $this->nodeExportService->export($siteNode->getPath(), $contentContext->getWorkspaceName(), $this->xmlWriter, false, false, $this->resourcesPath, $nodeTypeFilter);

        $this->xmlWriter->endElement();
    }
427376
public void setWorkplaceSite(String newSite) {

        String oldSite = getWorkplaceSite();
        // get the site list
        String siteList = getExtProperty("site.root.list");
        // replace old site URL in site list with new site URL
        siteList = CmsStringUtil.substitute(siteList, oldSite, newSite);
        setExtProperty("site.root.list", siteList);
        setExtProperty("site.workplace", newSite);
    }
1109575
public function setSite(\BiberLtd\Bundle\SiteManagementBundle\Entity\Site $site) {
        if(!$this->setModified('site', $site)->isModified()) {
            return $this;
        }
		$this->site = $site;
		return $this;
    }
1344708
public void setSiteRoot(String siteRoot) {

        // site roots must never end with a "/"
        if (siteRoot.endsWith("/")) {
            m_siteRoot = siteRoot.substring(0, siteRoot.length() - 1);
        } else {
            m_siteRoot = siteRoot;
        }
    }
652749
public function setSite(\BackBee\Site\Site $site = null)
    {
        $this->_site = $site;

        return $this;
    }