Set up multi-site requirements, e.g. the needed asset collection.

Call this (at least) once after a site has been installed.

@param string $siteNodeName
@return void
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.');
    }
1329869
public function pruneCommand($siteNode)
    {
        $sites = $this->findSitesByNodeNamePattern($siteNode);
        if (empty($sites)) {
            $this->outputLine('<error>No Site found for pattern "%s".</error>', [$siteNode]);
            // Help the user a little about what he needs to provide as a parameter here
            $this->outputLine('To find out which sites you have, use the <b>site:list</b> command.');
            $this->outputLine('The site:prune command expects the "Node name" from the site list as a parameter.');
            $this->outputLine('If you want to delete all sites, you can run <b>site:prune \'*\'</b>.');
            $this->quit(1);
        }
        foreach ($sites as $site) {
            $this->siteService->pruneSite($site);
            $this->outputLine('Site with root "%s" matched pattern "%s" and has been removed.', [$site->getNodeName(), $siteNode]);
        }
    }
1176020
public function setHiddenInIndex($hidden)
    {
        if ($this->hiddenInIndex !== (boolean)$hidden) {
            $this->hiddenInIndex = (boolean)$hidden;
            $this->addOrUpdate();
        }
    }
1326341
public function setSiteAliasId(int $nb_site_alias_id) : CNabuDataObject
    {
        if ($nb_site_alias_id === null) {
            throw new ENabuCoreException(
                    ENabuCoreException::ERROR_NULL_VALUE_NOT_ALLOWED_IN,
                    array("\$nb_site_alias_id")
            );
        }
        $this->setValue('nb_site_alias_id', $nb_site_alias_id);
        
        return $this;
    }
1195170
@Override
	public void postSetup(Site site) {
		if(processors != null){
			for(Processor p: processors){
				p.postSetup(site);
			}
		}
	}
361600
public function deleteSiteAction(Site $site)
    {
        $this->siteService->pruneSite($site);
        $this->addFlashMessage('The site "%s" has been deleted.', 'Site deleted', Message::SEVERITY_OK, [htmlspecialchars($site->getName())], 1412372689);
        $this->unsetLastVisitedNodeAndRedirect('index');
    }
97804
public function onSiteCreate(SiteEvent $event)
    {
        $site = $event->getSite();

        $this->service->getNotificationService()->subscribe('site', $site->getId(), $site->getOwnerUserId());
    }
1181336
public function setSite($siteId, $siteName, $siteDefaultLanguage, array $languages)
    {
        $this->siteId = $siteId;
        $this->session->set(
            self::KEY_SITE,
            array(
                'siteId' => $siteId,
                'name' => $siteName,
                'defaultLanguage' => $siteDefaultLanguage,
                'languages' => $languages,
            )
        );
    }
474280
public function setSite($site = null)
    {
        $this->site = null;

        if (($site = SiteHelper::resolve($site)) === null) {
            $this->site = $this->siteId = null;
        } else {
            $this->siteId = $site->id;
            $this->site = $site;
        }

        return $this;
    }
848957
public function newDomainAction(Domain $domain = null, Site $site = null)
    {
        $this->view->assignMultiple([
            'domain' => $domain,
            'site' => $site,
            'schemes' => [null => '', 'http' => 'HTTP', 'https' => 'HTTPS']
        ]);
    }
1091201
protected function applySiteConditions()
    {
        if ($this->site !== null) {
            $this->andWhere(Db::parseParam('siteId', $this->parseSiteValue($this->site)));
        } else {
            $this->andWhere(Db::parseParam('siteId', Craft::$app->getSites()->currentSite->id));
        }
    }
15897
protected function updateSite($multisite) {
    $this->say("Deploying updates to <comment>$multisite</comment>...");
    $this->switchSiteContext($multisite);

    $this->invokeCommand('drupal:update');

    $this->say("Finished deploying updates to $multisite.");
  }
346976
public function onSitemapNodeDelete(TreeNodeEvent $event)
    {
        $node = $event->getNode();
        if (TextNodeInterface::NODE_TYPE === $node->getType()) {
            $this->nodeHandler->onDeleteNode($node);
        }
    }
1299539
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);
        }

        $site->setPrimaryDomain(null);
        $this->siteRepository->update($site);

        $domainsForSite = $this->domainRepository->findBySite($site);
        foreach ($domainsForSite as $domain) {
            $this->domainRepository->remove($domain);
        }
        $this->persistenceManager->persistAll();

        $this->siteRepository->remove($site);

        $this->emitSitePruned($site);
    }
1240947
public function init($themePath)
    {
        $this->themePath = $themePath;
        $this->themeURL = get_bloginfo('url');

        add_action('after_setup_theme', array($this, 'afterSetupTheme'));
        add_action('template_include', array($this, 'templateInclude'));

    }
1226046
public function onSitemapNodeEdit(SitemapNodeEvent $event)
    {
        $node = $event->getNode();
        if (in_array($node->getType(), $this->textNodeTypes)) {
            $tab = new Tab(
                $event->getTranslator()->trans('text', array(), 'SilvestraTextNodeBundle'),
                'silvestra_text_node',
                $event->getRouter()->generate(
                    'silvestra_text_node',
                    array('_format' => 'json', 'nodeId' => $node->getId())
                )
            );

            $event->addTab($tab);
        }
    }
151954
public function activateCommand($siteNode)
    {
        $sites = $this->findSitesByNodeNamePattern($siteNode);
        if (empty($sites)) {
            $this->outputLine('<error>No Site found for pattern "%s".</error>', [$siteNode]);
            $this->quit(1);
        }
        foreach ($sites as $site) {
            $site->setState(Site::STATE_ONLINE);
            $this->siteRepository->update($site);
            $this->outputLine('Site "%s" was activated.', [$site->getNodeName()]);
        }
    }