예제 #1
0
 /**
  * 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));
 }
예제 #2
0
 /**
  * Provide test-data.
  */
 public function dataProvider()
 {
     $certificate = new Certificate();
     $domainWithoutIp = new Domain();
     $domainWithoutIp->setDomain('withoutIp.de');
     $ipaddressWithSSL = new IpAddress();
     $ipaddressWithSSL->setHasSsl(true);
     $ipaddressWithoutSSL = new IpAddress();
     $ipaddressWithoutSSL->setHasSsl(false);
     $domainWithIPs = new Domain();
     $domainWithIPs->setDomain('withIp.de')->setIpaddress(new ArrayCollection(array($ipaddressWithoutSSL, $ipaddressWithSSL)))->setCertificate($certificate);
     $subdomainWithSSL = new Subdomain($domainWithIPs);
     $subdomainWithSSL->setCertificate($certificate)->setSubdomain('withssl');
     $subdomainWithSSL2 = new Subdomain($domainWithoutIp);
     $subdomainWithSSL2->setCertificate($certificate)->setSubdomain('withssl');
     $subdomainWithoutSSL = new Subdomain($domainWithIPs);
     $subdomainWithoutSSL->setSubdomain('withoutssl');
     $subdomainWithoutSSL2 = new Subdomain($domainWithoutIp);
     $subdomainWithoutSSL2->setSubdomain('withoutssl');
     return array(array($domainWithIPs, $subdomainWithoutSSL), array($domainWithIPs, $subdomainWithSSL), array($domainWithoutIp, $subdomainWithSSL2), array($domainWithoutIp, $subdomainWithoutSSL2), array($domainWithIPs), array($domainWithoutIp));
 }
예제 #3
0
 /**
  * Dataprovider for testGetVhostAddress.
  *
  * @return array
  */
 public function providerTestGetVhostAddress()
 {
     $ip4 = new IpAddress();
     $vhost4 = new Vhost();
     $ip6 = new IpAddress();
     $vhost6 = new Vhost();
     $ip4->setIp('127.0.0.1')->setPort(80);
     $vhost4->setIpaddress($ip4);
     $ip6->setIp('2001:db8::1428:57ab')->setPort(80);
     $vhost6->setIpaddress($ip6);
     return array(array($vhost4, '127.0.0.1:80'), array($vhost6, '[2001:db8::1428:57ab]:80'));
 }
예제 #4
0
파일: Vhost.php 프로젝트: jeboehm/lampcp
 /**
  * Get IP Address
  *
  * @return IpAddress
  */
 public function getIpaddress()
 {
     if ($this->ipaddress) {
         $ipaddress = $this->ipaddress;
     } else {
         $ipaddress = new IpAddress();
         $ipaddress->setIp('*')->setPort(80)->setHasSsl(false);
     }
     return $ipaddress;
 }
예제 #5
0
 /**
  * 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;
 }