mirror of
https://github.com/getnamingo/registry.git
synced 2025-06-28 07:03:28 +02:00
Added launch phase delete for EPP
This commit is contained in:
parent
de119b013f
commit
7e34dd7501
5 changed files with 196 additions and 169 deletions
|
@ -1325,35 +1325,6 @@ class ApplicationsController extends Controller
|
|||
try {
|
||||
$db->beginTransaction();
|
||||
|
||||
$hostIds = $db->select(
|
||||
'SELECT id FROM host WHERE domain_id = ?',
|
||||
[$domain_id]
|
||||
);
|
||||
|
||||
foreach ($hostIds as $host) {
|
||||
$host_id = $host['id'];
|
||||
|
||||
// Delete operations
|
||||
$db->delete(
|
||||
'host_addr',
|
||||
[
|
||||
'host_id' => $host_id
|
||||
]
|
||||
);
|
||||
$db->delete(
|
||||
'host_status',
|
||||
[
|
||||
'host_id' => $host_id
|
||||
]
|
||||
);
|
||||
$db->delete(
|
||||
'application_host_map',
|
||||
[
|
||||
'host_id' => $host_id
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// Delete domain related records
|
||||
$db->delete(
|
||||
'application_contact_map',
|
||||
|
|
|
@ -577,6 +577,7 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
$extensionNode = $xml->command->extension;
|
||||
if (isset($extensionNode)) {
|
||||
$fee_create = $xml->xpath('//fee:create')[0] ?? null;
|
||||
$launch_create = $xml->xpath('//launch:create')[0] ?? null;
|
||||
}
|
||||
|
||||
$parts = extractDomainAndTLD($domainName);
|
||||
|
|
|
@ -169,6 +169,11 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
$domainName = $xml->command->delete->children('urn:ietf:params:xml:ns:domain-1.0')->delete->name;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
$extensionNode = $xml->command->extension;
|
||||
if (isset($extensionNode)) {
|
||||
$launch_delete = $xml->xpath('//launch:delete')[0] ?? null;
|
||||
}
|
||||
|
||||
if (!$domainName) {
|
||||
sendEppError($conn, $db, 2003, 'Please specify the domain name that will be deleted', $clTRID, $trans);
|
||||
return;
|
||||
|
@ -181,7 +186,11 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (isset($launch_delete)) {
|
||||
$stmt = $db->prepare("SELECT id, tldid, registrant, crdate, exdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, rgpstatus, addPeriod, autoRenewPeriod, renewPeriod, renewedDate, transferPeriod FROM application WHERE name = :name LIMIT 1");
|
||||
} else {
|
||||
$stmt = $db->prepare("SELECT id, tldid, registrant, crdate, exdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, rgpstatus, addPeriod, autoRenewPeriod, renewPeriod, renewedDate, transferPeriod FROM domain WHERE name = :name LIMIT 1");
|
||||
}
|
||||
$stmt->execute([':name' => $domainName]);
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
|
@ -222,6 +231,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!isset($launch_delete)) {
|
||||
$stmt = $db->prepare("SELECT status FROM domain_status WHERE domain_id = :domain_id");
|
||||
$stmt->execute([':domain_id' => $domain_id]);
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
@ -231,7 +241,45 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($launch_delete)) {
|
||||
$phaseType = (string) $launch_delete->children('urn:ietf:params:xml:ns:launch-1.0')->phase;
|
||||
$applicationID = (string) $launch_delete->children('urn:ietf:params:xml:ns:launch-1.0')->applicationID;
|
||||
|
||||
$stmt = $db->prepare("SELECT id FROM application WHERE name = ? AND phase_type = ? AND application_id = ? LIMIT 1");
|
||||
$stmt->execute([$domainName, $phaseType, $applicationID]);
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$result) {
|
||||
sendEppError($conn, $db, 2306, "Please verify the launch phase and/or the application ID", $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
// Delete application related records
|
||||
$db->exec("DELETE FROM application_contact_map WHERE domain_id = $domain_id");
|
||||
$db->exec("DELETE FROM application_host_map WHERE domain_id = $domain_id");
|
||||
$db->exec("DELETE FROM application_status WHERE domain_id = $domain_id");
|
||||
|
||||
$stmt = $db->prepare("DELETE FROM application WHERE id = ?");
|
||||
$stmt->execute([$domain_id]);
|
||||
|
||||
if ($stmt->errorCode() != "00000") {
|
||||
sendEppError($conn, $db, 2400, 'The application has not been deleted, it has something to do with other objects', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
||||
$svTRID = generateSvTRID();
|
||||
$response = [
|
||||
'command' => 'delete_domain',
|
||||
'resultCode' => 1000,
|
||||
'lang' => 'en-US',
|
||||
'message' => 'Command completed successfully',
|
||||
'clTRID' => $clTRID,
|
||||
'svTRID' => $svTRID,
|
||||
];
|
||||
|
||||
} else {
|
||||
$grace_period = 30;
|
||||
|
||||
// DELETE FROM domain_status
|
||||
|
@ -389,6 +437,7 @@ function processDomainDelete($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
'clTRID' => $clTRID,
|
||||
'svTRID' => $svTRID,
|
||||
];
|
||||
}
|
||||
|
||||
$epp = new EPP\EppWriter();
|
||||
$xml = $epp->epp_writer($response);
|
||||
|
|
|
@ -172,6 +172,11 @@ function processDomainInfo($conn, $db, $xml, $trans) {
|
|||
$domainName = $xml->command->info->children('urn:ietf:params:xml:ns:domain-1.0')->info->name;
|
||||
$clTRID = (string) $xml->command->clTRID;
|
||||
|
||||
$extensionNode = $xml->command->extension;
|
||||
if (isset($extensionNode)) {
|
||||
$launch_info = $xml->xpath('//launch:info')[0] ?? null;
|
||||
}
|
||||
|
||||
$result = $xml->xpath('//domain:authInfo/domain:pw[1]');
|
||||
if (!empty($result)) {
|
||||
$authInfo_pw = (string)$result[0];
|
||||
|
|
|
@ -931,6 +931,7 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
if (isset($extensionNode)) {
|
||||
$rgp_update = $xml->xpath('//rgp:update')[0] ?? null;
|
||||
$secdns_update = $xml->xpath('//secDNS:update')[0] ?? null;
|
||||
$launch_update = $xml->xpath('//launch:update')[0] ?? null;
|
||||
}
|
||||
|
||||
if ($domainRem === null && $domainAdd === null && $domainChg === null && $extensionNode === null) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue