/** * Get service. * * @return VhostBuilderService */ public function serviceProvider() { $service = $this->getVhostBuilderService(); $certificate = new Certificate(); $user = new User(); $defaultIpSsl = new IpAddress(); $defaultIp = new IpAddress(); $certificate->setName('normal')->setCertificateFile('asd')->setCertificateKeyFile('dodooodood'); $user->setName('jeff')->setGroupname('jeff')->setUid(1000)->setGid(1000); $defaultIp->setAlias('default, no ssl')->setHasSsl(false)->setIp('127.0.0.1')->setPort(80); $defaultIpSsl->setAlias('default, ssl')->setHasSsl(true)->setIp('127.0.0.1')->setPort(443); $domain1 = new Domain(); $domain2 = new Domain(); $domain3 = new Domain(); $domain1->setDomain('lampcp1.de')->setPath('/var/www/lampcp1.de')->setParsePhp(true)->setUser($user)->setWebroot('htdocs')->setCertificate($certificate); $domain2->setDomain('lampcp2.de')->setPath('/var/www/lampcp2.de')->setParsePhp(true)->setUser($user)->setWebroot('htdocs'); $domain3->setDomain('lampcp3.de')->setPath('/var/www/lampcp3.de')->setParsePhp(false)->setUser($user)->setWebroot('htdocs')->setCertificate($certificate); $domain1->getIpaddress()->add($defaultIp); $domain2->getIpaddress()->add($defaultIpSsl); $domain2->getIpaddress()->add($defaultIp); $domain3->getIpaddress()->add($defaultIpSsl); $subdomain1 = new Subdomain($domain1); $subdomain2 = new Subdomain($domain2); $subdomain1->setSubdomain('nopaste'); $subdomain2->setSubdomain('wiki'); $domain1->getSubdomain()->add($subdomain1); $domain2->getSubdomain()->add($subdomain2); $service->setDomains(array($domain1, $domain2, $domain3)); return array(array($service)); }
/** * Generate LampCP Domain. * * @param Vhost $vhost * * @return Domain * @throws UserNotFoundException */ protected function _generateLampcpDomain(Vhost $vhost) { $domain = new Domain(); $ip = new IpAddress(); /** @var User $user */ $user = $this->getUserRepository()->findOneBy(array('name' => $vhost->user)); if (!$user) { throw new UserNotFoundException(); } $ip->setAlias('Default ip address')->setIp($vhost->ipaddress); $domain->setDomain($vhost->address)->setPath(realpath(__DIR__ . '/../../../../../../'))->setWebroot('htdocs/web')->setUser($user)->getIpaddress()->add($ip); return $domain; }