/
home
/
clp
/
htdocs
/
app
/
files
/
src
/
Command
/
up file
home
<?php namespace App\Command; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Validator\ConstraintViolationList; use Doctrine\Common\Collections\ArrayCollection; use App\Command\Command as BaseCommand; use App\Entity\Site as SiteEntity; use App\Site\Site; use App\Site\NodejsSite; use App\Site\StaticSite; use App\Site\PhpSite; use App\Site\PythonSite; use App\Site\ReverseProxySite; use App\Site\Deleter as SiteDeleter; use App\Site\Updater as SiteUpdater; use App\Site\Updater\NodejsSite as NodejsSiteUpdater; use App\Site\Updater\StaticSite as StaticSiteUpdater; use App\Site\Updater\PhpSite as PhpSiteUpdater; use App\Site\Updater\PythonSite as PythonSiteUpdater; use App\Site\Updater\ReverseProxySite as ReverseProxySiteUpdater; use App\Site\Deleter\NodejsSite as NodejsSiteDeleter; use App\Site\Deleter\StaticSite as StaticSiteDeleter; use App\Site\Deleter\PhpSite as PhpSiteDeleter; use App\Site\Deleter\PythonSite as PythonSiteDeleter; use App\Site\Deleter\ReverseProxySite as ReverseProxySiteDeleter; use App\Site\Parser\DomainName as DomainNameParser; use App\Entity\Manager\SiteManager as SiteEntityManager; use App\Entity\Manager\CertificateManager as CertificateEntityManager; use App\Entity\Manager\VhostTemplateManager as VhostTemplateEntityManager; use App\Entity\Manager\DatabaseServerManager as DatabaseServerEntityManager; class SiteCommand extends BaseCommand { protected DomainNameParser $domainNameParser; protected SiteEntityManager $siteEntityManager; protected CertificateEntityManager $certificateEntityManager; protected DatabaseServerEntityManager $databaseServerEntityManager; protected VhostTemplateEntityManager $vhostTemplateEntityManager; protected ValidatorInterface $validator; public function __construct(DomainNameParser $domainNameParser, SiteEntityManager $siteEntityManager, CertificateEntityManager $certificateEntityManager, DatabaseServerEntityManager $databaseServerEntityManager, VhostTemplateEntityManager $vhostTemplateEntityManager, ValidatorInterface $validator) { goto f87c0; d1d81: parent::__construct(); goto b7e35; c3f6d: $this->databaseServerEntityManager = $databaseServerEntityManager; goto Ba9bc; B2884: $this->certificateEntityManager = $certificateEntityManager; goto c3f6d; f87c0: $this->domainNameParser = $domainNameParser; goto d12d3; a93f9: $this->validator = $validator; goto d1d81; d12d3: $this->siteEntityManager = $siteEntityManager; goto B2884; Ba9bc: $this->vhostTemplateEntityManager = $vhostTemplateEntityManager; goto a93f9; b7e35: } protected function configure() : void { $this->setName("\x73\x69\x74\145\x3a\x74\x6d\x70"); } protected function getSite(string $domainName) : ?Site { goto e30f2; a3721: $registrableDomain = $resolvedDomainName->registrableDomain()->toString(); goto C4890; Ac864: $site->setVhostTemplate($siteEntity->getVhostTemplate()); goto ee839; A1fec: acf21: goto dd9b3; F0d8e: $site->setPageSpeedEnabled($siteEntity->getPageSpeedEnabled()); goto e1229; ef86d: $site->setCronJobs($siteEntity->getCronJobs()); goto B9b6b; e1229: $site->setPageSpeedSettings($siteEntity->getPageSpeedSettings()); goto cd8e3; de328: $siteEntity = $this->getSiteEntity($domainName); goto E1ea1; d536c: goto d63bf; goto A1fec; Dd9ce: $site->setSubdomain($subdomain); goto d9ff3; Ef237: return $site; goto bfa33; ee839: $site->setAllowTrafficFromCloudflareOnly($siteEntity->allowTrafficFromCloudflareOnly()); goto F0d8e; dd9b3: $siteType = $siteEntity->getType(); goto De008; C4890: $subdomain = $resolvedDomainName->subDomain()->toString(); goto Fed83; Dd555: Ba965: goto C0b54; D2078: $site->setDomainName($siteEntity->getDomainName()); goto a2c16; E8c66: $site->setCertificate($siteEntity->getCertificate()); goto bedac; De008: switch ($siteType) { case SiteEntity::TYPE_NODEJS: goto faf25; d98b2: $site->setNodejsSettings($siteEntity->getNodejsSettings()); goto Cef89; Cef89: goto Ba965; goto E690d; faf25: $site = new NodejsSite(); goto d98b2; E690d: case SiteEntity::TYPE_STATIC: $site = new StaticSite(); goto Ba965; case SiteEntity::TYPE_PHP: goto F0980; F0980: $site = new PhpSite(); goto D0512; E7e4c: goto Ba965; goto F43ca; a592f: $site->setVarnishCache($siteEntity->getVarnishCache()); goto E7e4c; D0512: $site->setPhpSettings($siteEntity->getPhpSettings()); goto a592f; F43ca: case SiteEntity::TYPE_PYTHON: goto ebee1; ebee1: $site = new PythonSite(); goto A54b9; ccdf6: goto Ba965; goto cd013; A54b9: $site->setPythonSettings($siteEntity->getPythonSettings()); goto ccdf6; cd013: case SiteEntity::TYPE_REVERSE_PROXY: goto fb95e; Fe320: goto Ba965; goto f9343; Ccde4: $site->setReverseProxyUrl($siteEntity->getReverseProxyUrl()); goto Fe320; fb95e: $site = new ReverseProxySite(); goto Ccde4; f9343: } goto a72cf; C0b54: if (!(false === is_null($site))) { goto cd1e5; } goto ef399; E1ea1: if (false === is_null($siteEntity)) { goto acf21; } goto c4f10; F583e: $site->setSshUsers($siteEntity->getSshUsers()); goto Ac864; a2c16: $site->setRegistrableDomain($registrableDomain); goto Dd9ce; e30f2: $site = null; goto de328; B9b6b: $site->setFtpUsers($siteEntity->getFtpUsers()); goto F583e; b4a33: $site->setBlockedBots($siteEntity->getBlockedBots()); goto D8071; Fed83: $subdomain = false === empty($subdomain) ? $subdomain : null; goto Aeeba; bedac: $site->setCertificates($siteEntity->getCertificates()); goto ef86d; c4f10: throw new \Exception(sprintf("\123\151\164\x65\40\x22\45\x73\x22\x20\144\157\145\x73\40\156\157\x74\40\145\170\x69\x73\164\x2e", $domainName)); goto d536c; Dabc7: d63bf: goto Ef237; Aeeba: $siteDatabases = $this->getSiteDatabases($siteEntity); goto Ae0b8; d9ff3: $site->setRootDirectory($siteEntity->getRootDirectory()); goto b31c1; Ae0b8: $site->setUser($siteEntity->getUser()); goto D2078; a72cf: D0f24: goto Dd555; ef399: $resolvedDomainName = $this->domainNameParser->resolveDomainName($domainName); goto a3721; cd8e3: cd1e5: goto Dabc7; D8071: $site->setBlockedIps($siteEntity->getBlockedIps()); goto E8c66; a3f8e: $site->setBasicAuth($siteEntity->getBasicAuth()); goto b4a33; b31c1: $site->setDatabases($siteDatabases); goto a3f8e; bfa33: } private function getSiteDatabases(SiteEntity $siteEntity) : ?ArrayCollection { goto Ddb75; D554a: foreach ($databaseEntities as $databaseEntity) { goto c13bc; F6fbc: if (!($databaseServerEntity->getId() == $activeDatabaseServerEntity->getId())) { goto B026a; } goto A94fc; F5ede: B026a: goto C2f49; c13bc: $databaseServerEntity = $databaseEntity->getDatabaseServer(); goto F6fbc; A94fc: $siteDatabases->add($databaseEntity); goto F5ede; C2f49: Bbd95: goto E40dc; E40dc: } goto ffd38; ffd38: a9912: goto de290; af162: $activeDatabaseServerEntity = $this->databaseServerEntityManager->getActiveDatabaseServer(); goto E3575; de290: return $siteDatabases; goto bbcdc; E3575: $databaseEntities = $siteEntity->getDatabases(); goto D554a; Ddb75: $siteDatabases = new ArrayCollection(); goto af162; bbcdc: } protected function getSiteDeleter(Site $site) : ?SiteDeleter { goto a43db; A8f75: D8ad4: goto F8a92; F8a92: B296c: goto Eaef0; Eaef0: return $siteDeleter; goto d2e66; a43db: $siteDeleter = null; goto de82e; F4745: switch ($siteType) { case SiteEntity::TYPE_NODEJS: $siteDeleter = new NodejsSiteDeleter($site); goto B296c; case SiteEntity::TYPE_STATIC: $siteDeleter = new StaticSiteDeleter($site); goto B296c; case SiteEntity::TYPE_PHP: $siteDeleter = new PhpSiteDeleter($site); goto B296c; case SiteEntity::TYPE_PYTHON: $siteDeleter = new PythonSiteDeleter($site); goto B296c; case SiteEntity::TYPE_REVERSE_PROXY: $siteDeleter = new ReverseProxySiteDeleter($site); goto B296c; } goto A8f75; de82e: $siteType = $site->getType(); goto F4745; d2e66: } protected function getSiteUpdater(Site $site) : ?SiteUpdater { goto f2f4d; D1a32: $siteType = $site->getType(); goto Cdc8d; F5121: return $siteUpdater; goto B5ba1; f2f4d: $siteUpdater = null; goto D1a32; c7072: A5b2e: goto Bc76c; Cdc8d: switch ($siteType) { case SiteEntity::TYPE_NODEJS: $siteUpdater = new NodejsSiteUpdater($site); goto Efd68; case SiteEntity::TYPE_STATIC: $siteUpdater = new StaticSiteUpdater($site); goto Efd68; case SiteEntity::TYPE_PHP: $siteUpdater = new PhpSiteUpdater($site); goto Efd68; case SiteEntity::TYPE_PYTHON: $siteUpdater = new PythonSiteUpdater($site); goto Efd68; case SiteEntity::TYPE_REVERSE_PROXY: $siteUpdater = new ReverseProxySiteUpdater($site); goto Efd68; } goto c7072; Bc76c: Efd68: goto F5121; B5ba1: } protected function getSiteEntity(string $domainName) : ?SiteEntity { $siteEntity = $this->siteEntityManager->findOneByDomainName($domainName); return $siteEntity; } protected function getSiteEntityBySiteUser(string $siteUser) : ?SiteEntity { $siteEntity = $this->siteEntityManager->findOneByUser($siteUser); return $siteEntity; } protected function prepareConstraints(ConstraintViolationList $constraints) : void { $this->changePropertyPath("\x75\x73\145\x72", "\163\151\164\145\x55\x73\x65\x72", $constraints); $this->changePropertyPath("\165\x73\145\162\x50\x61\163\163\167\157\162\x64", "\163\x69\164\x65\125\x73\145\162\120\141\x73\163\x77\157\162\144", $constraints); } }