mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-03 17:43:22 +02:00
Added minimum data set support for automation
This commit is contained in:
parent
1a17fdfddc
commit
1e8ab1466d
3 changed files with 93 additions and 80 deletions
|
@ -18,6 +18,7 @@ try {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$dbh->beginTransaction();
|
$dbh->beginTransaction();
|
||||||
|
$minimum_data = $c['minimum_data'];
|
||||||
|
|
||||||
$query_domain = "SELECT id, name, registrant, crdate, exdate, lastupdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, transfer_exdate FROM domain WHERE CURRENT_TIMESTAMP > acdate AND trstatus = 'pending'";
|
$query_domain = "SELECT id, name, registrant, crdate, exdate, lastupdate, clid, crid, upid, trdate, trstatus, reid, redate, acid, acdate, transfer_exdate FROM domain WHERE CURRENT_TIMESTAMP > acdate AND trstatus = 'pending'";
|
||||||
$stmt_domain = $dbh->prepare($query_domain);
|
$stmt_domain = $dbh->prepare($query_domain);
|
||||||
|
@ -60,6 +61,7 @@ try {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$minimum_data) {
|
||||||
// Fetch contact map
|
// Fetch contact map
|
||||||
$stmt = $dbh->prepare('SELECT contact_id, type FROM domain_contact_map WHERE domain_id = ?');
|
$stmt = $dbh->prepare('SELECT contact_id, type FROM domain_contact_map WHERE domain_id = ?');
|
||||||
$stmt->execute([$domain_id]);
|
$stmt->execute([$domain_id]);
|
||||||
|
@ -99,12 +101,14 @@ try {
|
||||||
}
|
}
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Insert auth info and status for the new registrant
|
// Insert auth info and status for the new registrant
|
||||||
$new_authinfo = generateAuthInfo();
|
$new_authinfo = generateAuthInfo();
|
||||||
$dbh->prepare('INSERT INTO contact_authInfo (contact_id, authtype, authinfo) VALUES (?, ?, ?)')->execute([$newRegistrantId, 'pw', $new_authinfo]);
|
$dbh->prepare('INSERT INTO contact_authInfo (contact_id, authtype, authinfo) VALUES (?, ?, ?)')->execute([$newRegistrantId, 'pw', $new_authinfo]);
|
||||||
$dbh->prepare('INSERT INTO contact_status (contact_id, status) VALUES (?, ?)')->execute([$newRegistrantId, 'ok']);
|
$dbh->prepare('INSERT INTO contact_status (contact_id, status) VALUES (?, ?)')->execute([$newRegistrantId, 'ok']);
|
||||||
|
|
||||||
|
if (!$minimum_data) {
|
||||||
// Process each contact in the contact map
|
// Process each contact in the contact map
|
||||||
foreach ($contactMap as $contact) {
|
foreach ($contactMap as $contact) {
|
||||||
if (!array_key_exists($contact['contact_id'], $newContactIds)) {
|
if (!array_key_exists($contact['contact_id'], $newContactIds)) {
|
||||||
|
@ -144,6 +148,7 @@ try {
|
||||||
$dbh->prepare('INSERT INTO contact_status (contact_id, status) VALUES (?, ?)')->execute([$newContactId, 'ok']);
|
$dbh->prepare('INSERT INTO contact_status (contact_id, status) VALUES (?, ?)')->execute([$newContactId, 'ok']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$from = $dbh->query("SELECT exdate FROM domain WHERE id = '$domain_id' LIMIT 1")->fetchColumn();
|
$from = $dbh->query("SELECT exdate FROM domain WHERE id = '$domain_id' LIMIT 1")->fetchColumn();
|
||||||
|
|
||||||
|
@ -154,6 +159,7 @@ try {
|
||||||
$stmt_update_auth = $dbh->prepare("UPDATE domain_authInfo SET authinfo = '$new_authinfo' WHERE domain_id = '$domain_id'");
|
$stmt_update_auth = $dbh->prepare("UPDATE domain_authInfo SET authinfo = '$new_authinfo' WHERE domain_id = '$domain_id'");
|
||||||
$stmt_update_auth->execute();
|
$stmt_update_auth->execute();
|
||||||
|
|
||||||
|
if (!$minimum_data) {
|
||||||
foreach ($contactMap as $contact) {
|
foreach ($contactMap as $contact) {
|
||||||
// Construct the SQL update query
|
// Construct the SQL update query
|
||||||
$sql = "UPDATE domain_contact_map SET contact_id = :new_contact_id WHERE domain_id = :domain_id AND type = :type AND contact_id = :contact_id";
|
$sql = "UPDATE domain_contact_map SET contact_id = :new_contact_id WHERE domain_id = :domain_id AND type = :type AND contact_id = :contact_id";
|
||||||
|
@ -170,6 +176,7 @@ try {
|
||||||
// Execute the update statement
|
// Execute the update statement
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$stmt_update_host = $dbh->prepare("UPDATE host SET clid = '$reid', upid = NULL, lastupdate = CURRENT_TIMESTAMP, trdate = CURRENT_TIMESTAMP WHERE domain_id = '$domain_id'");
|
$stmt_update_host = $dbh->prepare("UPDATE host SET clid = '$reid', upid = NULL, lastupdate = CURRENT_TIMESTAMP, trdate = CURRENT_TIMESTAMP WHERE domain_id = '$domain_id'");
|
||||||
$stmt_update_host->execute();
|
$stmt_update_host->execute();
|
||||||
|
|
|
@ -19,6 +19,7 @@ try {
|
||||||
try {
|
try {
|
||||||
// Auto-Renew Grace Period
|
// Auto-Renew Grace Period
|
||||||
$auto_renew = 0;
|
$auto_renew = 0;
|
||||||
|
$minimum_data = $c['minimum_data'];
|
||||||
|
|
||||||
if ($auto_renew) {
|
if ($auto_renew) {
|
||||||
$sth_autorenewperiod = $dbh->prepare("SELECT id, name, tldid, exdate, clid FROM domain WHERE CURRENT_TIMESTAMP > exdate AND rgpstatus IS NULL");
|
$sth_autorenewperiod = $dbh->prepare("SELECT id, name, tldid, exdate, clid FROM domain WHERE CURRENT_TIMESTAMP > exdate AND rgpstatus IS NULL");
|
||||||
|
@ -194,7 +195,9 @@ try {
|
||||||
$dbh->exec("DELETE FROM domain_host_map WHERE host_id = '$host_id'");
|
$dbh->exec("DELETE FROM domain_host_map WHERE host_id = '$host_id'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$minimum_data) {
|
||||||
$dbh->exec("DELETE FROM domain_contact_map WHERE domain_id = '$domain_id'");
|
$dbh->exec("DELETE FROM domain_contact_map WHERE domain_id = '$domain_id'");
|
||||||
|
}
|
||||||
$dbh->exec("DELETE FROM domain_host_map WHERE domain_id = '$domain_id'");
|
$dbh->exec("DELETE FROM domain_host_map WHERE domain_id = '$domain_id'");
|
||||||
$dbh->exec("DELETE FROM domain_authInfo WHERE domain_id = '$domain_id'");
|
$dbh->exec("DELETE FROM domain_authInfo WHERE domain_id = '$domain_id'");
|
||||||
$dbh->exec("DELETE FROM domain_status WHERE domain_id = '$domain_id'");
|
$dbh->exec("DELETE FROM domain_status WHERE domain_id = '$domain_id'");
|
||||||
|
|
|
@ -75,4 +75,7 @@ return [
|
||||||
// LORDN Configuration
|
// LORDN Configuration
|
||||||
'lordn_user' => 'your_username',
|
'lordn_user' => 'your_username',
|
||||||
'lordn_pass' => 'your_password',
|
'lordn_pass' => 'your_password',
|
||||||
|
|
||||||
|
// Minimum Data Set
|
||||||
|
'minimum_data' => false,
|
||||||
];
|
];
|
Loading…
Add table
Add a link
Reference in a new issue