Commit e7e9ce17 authored by Thomas Citharel's avatar Thomas Citharel 🌲

Merge branch 'domain-tag-zone-prefix' into 'framasites'

add tag to created domains and prefix zone name

Closes #36

See merge request framasoft/framasite!12
parents 2b979034 d1b12f9b
Pipeline #25907 passed with stage
in 7 minutes and 41 seconds
......@@ -244,6 +244,7 @@ class DomainController extends Controller
$domain->setContacts([$userContact, $adminContact, $billContact, $techContact]);
$registerData = $this->domainFactory->registerDomain($domain);
$this->domainFactory->addTagToDomain('Framasite', $domain->getDomainName());
$em = $this->getDoctrine()->getManager();
if (isset($registerData['params']) && isset($registerData['params']['zone_id']) && $registerData['params']['zone_id'] != null) {
......
......@@ -92,7 +92,7 @@ class DomainFactory
/**
* Clone the default zone so that we don't have to set it afterwards
*/
$zone = $this->zoneFactory->cloneZone(new Zone($this->zoneFactory->getDefaultZone()), 0, $domain->getDomainName());
$zone = $this->zoneFactory->cloneZone(new Zone($this->zoneFactory->getDefaultZone()), 0, '__fsite_' . $domain->getDomainName());
$params = [
'admin' => $gandiContacts['admin'],
......@@ -281,6 +281,20 @@ class DomainFactory
}
}
/**
* @param string $tag
* @param string $domainName
* @throws APIException
*/
public function addTagToDomain(string $tag, string $domainName)
{
try {
$this->api->domain->tag->add($this->apiKey, $tag, $domainName);
} catch (\RuntimeException $e) {
throw new APIException($e->getMessage());
}
}
/**
* @param Domain $domain
* @throws APIException
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment