getSiteNotAvailableRedirectUrl

@param Site $site

@return string
763584
public function getSiteNotAvailableRedirectUrl(Site $site)
    {
        if ($site->isSiteAvailable()) {
            return null;
        }

        $defaultDomain = $this->domainService->getDefaultDomainName();

        if (empty($defaultDomain)) {
            return null;
        }

        if ($defaultDomain == $site->getDomain()->getDomainName()) {
            return null;
        }

        return $defaultDomain;
    }
211102
protected function getSiteName($sites, $site_id)
    {
        if ($site = $this->getSite($sites, $site_id)) {
            return $site->name;
        }
        return null;
    }
538616
public function findErrorsBySite(Site $site) : array
    {
        $queryBuilder = $this->getQueryBuilder();
        $errors = $queryBuilder
            ->select('uid', 'item_type', 'item_uid', 'errors')
            ->from($this->table)
            ->andWhere(
                $queryBuilder->expr()->notLike('errors', $queryBuilder->createNamedParameter('')),
                $queryBuilder->expr()->eq('root', $site->getRootPageId())
            )
            ->execute()->fetchAll();

        return $errors;
    }
232280
static function findPathToSiteAccess( $siteAccess )
    {
        $ini = eZINI::instance();
        $siteAccessList = $ini->variable( 'SiteAccessSettings', 'AvailableSiteAccessList' );
        if ( !in_array( $siteAccess, $siteAccessList )  )
            return false;

        $currentPath = 'settings/siteaccess/' . $siteAccess;
        if ( file_exists( $currentPath ) )
            return $currentPath;

        $activeExtensions = eZExtension::activeExtensions();
        $baseDir = eZExtension::baseDirectory();
        foreach ( $activeExtensions as $extension )
        {
            $currentPath = $baseDir . '/' . $extension . '/settings/siteaccess/' . $siteAccess;
            if ( file_exists( $currentPath ) )
                return $currentPath;
        }

        return 'settings/siteaccess/' . $siteAccess;
    }
923788
public static function siteUrl()
    {
        $base_url = self::requestInstance()->getDeterminedScheme().'://'.self::requestInstance()->getServerName().':'.self::requestInstance()->getServerPort().self::getUri();

        return $base_url;
    }
155039
private function SiteHostCondition(Site $site)
    {
        $siteUrl = $site->GetUrl();
        $host = parse_url($siteUrl, PHP_URL_HOST);
        return new RewriteCondition(new Variable(ServerVariable::HttpHost()), $host);
    }
227881
private function getUriForSite($pathinfo, Site $site = null)
    {
        $siteUsed = $this->getCurrentSite($site);
        if (null === $siteUsed || null === $this->application) {
            return $pathinfo;
        }

        $protocol = '';
        if (null === parse_url($siteUsed->getServerName(), PHP_URL_SCHEME)) {
            $protocol = (string) $this->defaultScheme;
            $protocol = $protocol . ($protocol ? ':' : '') . '//';
        }

        return $protocol . $siteUsed->getServerName() . $pathinfo;
    }
568445
public function getSettingList(Site $site)
    {
        $settingList = [];
        /** @var $setting \PageBuilder\Entity\Setting */
        foreach ($site->getSettings() as $setting) {
            $code               = $setting->getSettingKey()->getCode();
            $value              = $setting->getSettingValue() ?: $setting->getSettingKey()->getDefaultValue();
            $settingList[$code] = $value;
        }

        $locale                = $site->getLocale() ?: 'en_GB';
        $settingList           = array_merge($settingList, \Locale::parseLocale($locale));
        $settingList['locale'] = $locale;

        return $settingList;
    }
231259
public function unpublishElements(ReadSiteInterface $site)
    {
        $publishedStatus = $this->statusRepository->findOneByPublished();
        if (!$publishedStatus instanceof StatusInterface) {

            return self::ERROR_NO_PUBLISHED_STATUS;
        }

        $unpublishedStatus = $this->statusRepository->findOneByAutoUnpublishTo();
        if (!$unpublishedStatus instanceof StatusInterface) {

            return self::ERROR_NO_UNPUBLISHED_STATUS;
        }

        $elements = $this->repository->findElementToAutoUnpublish($site->getSiteId(), $publishedStatus);

        $unpublishedElements = array();
        foreach ($elements as $element) {
            $element->setStatus($unpublishedStatus);
            $this->objectManager->persist($element);
            $unpublishedElements[] = array(
                'name' => $element->getName(),
                'version' => $element->getVersion(),
                'language' => $element->getLanguage()
            );
        }
        $this->objectManager->flush();

        return $unpublishedElements;
    }
519339
protected function FormUrl(Site $site = null)
    {
        $args = array();
        if ($site)
        {
            $args['site'] = $site->GetID();
        }
        return BackendRouter::ModuleUrl(new SiteForm(), $args);
    }
369545
public function createEntity(Site $site = null)
    {
        if (!$site) {
            $site = new Site($this->config);
        } else {
            $site->updateSiteConfigRepository($this->config);
        }
        return $site;
    }
1014058
public function getConfigurationsBySite(Site $site)
    {
        $solrConfigurations = [];

        $allConfigurations = $this->getAllConfigurations();
        foreach ($allConfigurations as $configuration) {
            if ($configuration['rootPageUid'] == $site->getRootPageId()) {
                $solrConfigurations[] = $configuration;
            }
        }

        return $solrConfigurations;
    }
776631
static public function getMapRolesForSite($nb_site)
    {
        $nb_site_id = nb_getMixedValue($nb_site, NABU_SITE_FIELD_ID);
        if (is_numeric($nb_site_id)) {
            $retval = CNabuEngine::getEngine()
                    ->getMainDB()
                    ->getQueryAsObjectArray(
                        '\nabu\data\site\CNabuSiteMapRole', null,
                        'select smr.* '
                        . 'from nb_site_map sm, nb_site_map_role smr '
                       . 'where sm.nb_site_map_id=smr.nb_site_map_id '
                         . 'and sm.nb_site_id=%site_id$d '
                       . 'order by sm.nb_site_map_order, smr.nb_role_id',
                        array(
                            'site_id' => $nb_site_id
                        ), null, true
                    )
            ;
        } else {
            $retval = null;
        }

        return $retval;
    }
672932
public static function siteBaseUrl()
    {
        $base_url = self::requestInstance()->getDeterminedScheme().'://'.self::requestInstance()->getServerName().':'.self::requestInstance()->getServerPort().self::getBase();

        return $base_url;
    }
915587
protected function getSiteAliases($site) {
    /** @var \AcquiaCloudApi\Response\ApplicationResponse $site */
    $aliases = [];
    $sites = [];
    $this->output->writeln("<info>Gathering sites list from Acquia Cloud.</info>");

    $environments = $this->cloudApiClient->environments($site->uuid);
    $hosting = $site->hosting->type;
    $site_split = explode(':', $site->hosting->id);

    foreach ($environments as $env) {
      $domains = [];
      $domains = $env->domains;
      $this->say('<info>Found ' . count($domains) . ' sites for environment ' . $env->name . ', writing aliases...</info>');

      $sshFull = $env->sshUrl;
      $ssh_split = explode('@', $env->sshUrl);
      $envName = $env->name;
      $remoteHost = $ssh_split[1];
      $remoteUser = $ssh_split[0];

      if ($hosting == 'ace') {

        $siteID = $site_split[1];
        $uri = $env->domains[0];
        $sites[$siteID][$envName] = ['uri' => $uri];
        $siteAlias = $this->getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID);
        $sites[$siteID][$envName] = $siteAlias[$envName];

      }

      if ($hosting == 'acsf') {
        $this->say('<info>ACSF project detected - generating sites data....</info>');

        try {
          $acsf_sites = $this->getSitesJson($sshFull, $remoteUser);
        }
        catch (\Exception $e) {
          $this->logger->error("Could not fetch acsf data for $envName. Error: " . $e->getMessage());
        }

        // Look for list of sites and loop over it.
        if ($acsf_sites) {
          foreach ($acsf_sites['sites'] as $name => $info) {

            // Reset uri value to identify non-primary domains.
            $uri = NULL;

            // Get site prefix from main domain.
            if (strpos($name, '.acsitefactory.com')) {
              $acsf_site_name = explode('.', $name, 2);
              $siteID = $acsf_site_name[0];
            }
            if (!empty($siteID) && !empty($info['flags']['preferred_domain'])) {
              $uri = $name;
            }

            foreach ($domains as $site) {
              // Skip sites without primary domain as the alias will be invalid.
              if (isset($uri)) {
                $sites[$siteID][$envName] = ['uri' => $uri];
                $siteAlias = $this->getAliases($uri, $envName, $remoteHost, $remoteUser, $siteID);
                $sites[$siteID][$envName] = $siteAlias[$envName];
              } continue;
            }
          }

        }
      }

    }

    // Write the alias files to disk.
    foreach ($sites as $siteID => $aliases) {
      $this->writeSiteAliases($siteID, $aliases);

    }
  }
846552
public static function getUri($site, $url) {
		$site = $site ?: self::getHost($url);

		$site = self::wwwLess($site);
		$Idna = new IdnaConvert();
		// конвертим сайт в idna
		$idna = $Idna->encode($site);
		$page = self::httpLess($url);
		$page = str_replace(array("www.$site", $site, $idna, "www.$idna"), '', $page);

		return (empty($page)) ? '/' : $page;
	}
752264
public function setSite($site)
    {
        if (empty($site)) return $this;

        $this->checkSite($site);

        return $this->addMeta('site', $site);
    }