mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-21 10:06:05 +02:00
Fixes for the milliseconds
This commit is contained in:
parent
63aa36ff0a
commit
7f435b6721
5 changed files with 21 additions and 14 deletions
|
@ -365,7 +365,7 @@ class ContactsController extends Controller
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
$db->insert(
|
$db->insert(
|
||||||
'contact',
|
'contact',
|
||||||
|
|
|
@ -335,10 +335,10 @@ class DomainsController extends Controller
|
||||||
try {
|
try {
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$crdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
$crdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Current timestamp
|
||||||
|
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$currentDateTime->modify("+$date_add months");
|
$currentDateTime->modify("+$date_add months");
|
||||||
$exdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Expiry timestamp after $date_add months
|
$exdate = $currentDateTime->format('Y-m-d H:i:s.v'); // Expiry timestamp after $date_add months
|
||||||
|
|
||||||
|
@ -503,7 +503,7 @@ class DomainsController extends Controller
|
||||||
$from = $row['crdate'];
|
$from = $row['crdate'];
|
||||||
$to = $row['exdate'];
|
$to = $row['exdate'];
|
||||||
|
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$stdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
$stdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
$db->insert(
|
$db->insert(
|
||||||
'statement',
|
'statement',
|
||||||
|
@ -540,7 +540,7 @@ class DomainsController extends Controller
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$logdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
$logdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
$db->insert(
|
$db->insert(
|
||||||
'error_log',
|
'error_log',
|
||||||
|
@ -552,7 +552,7 @@ class DomainsController extends Controller
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$host_date = $currentDateTime->format('Y-m-d H:i:s.v');
|
$host_date = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
$host_id = $db->insert(
|
$host_id = $db->insert(
|
||||||
'host',
|
'host',
|
||||||
|
|
|
@ -127,7 +127,7 @@ class HostsController extends Controller
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
$db->insert(
|
$db->insert(
|
||||||
'host',
|
'host',
|
||||||
|
@ -203,7 +203,7 @@ class HostsController extends Controller
|
||||||
'registrars' => $registrars,
|
'registrars' => $registrars,
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
$currentDateTime = new DateTime();
|
$currentDateTime = new \DateTime();
|
||||||
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
$crdate = $currentDateTime->format('Y-m-d H:i:s.v');
|
||||||
$db->insert(
|
$db->insert(
|
||||||
'host',
|
'host',
|
||||||
|
|
|
@ -199,11 +199,14 @@ function handleDomainQuery($request, $response, $pdo, $domainName) {
|
||||||
// Perform the RDAP lookup
|
// Perform the RDAP lookup
|
||||||
try {
|
try {
|
||||||
// Query 1: Get domain details
|
// Query 1: Get domain details
|
||||||
$stmt1 = $pdo->prepare("SELECT *, DATE_FORMAT(`crdate`, '%Y-%m-%dT%TZ') AS `crdate`, DATE_FORMAT(`exdate`, '%Y-%m-%dT%TZ') AS `exdate` FROM `registry`.`domain` WHERE `name` = :domain");
|
$stmt1 = $pdo->prepare("SELECT * FROM `registry`.`domain` WHERE `name` = :domain");
|
||||||
$stmt1->bindParam(':domain', $domain, PDO::PARAM_STR);
|
$stmt1->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||||
$stmt1->execute();
|
$stmt1->execute();
|
||||||
$domainDetails = $stmt1->fetch(PDO::FETCH_ASSOC);
|
$domainDetails = $stmt1->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$domainDetails['crdate'] = (new DateTime($domainDetails['crdate']))->format('Y-m-d\TH:i:s.v\Z');
|
||||||
|
$domainDetails['exdate'] = (new DateTime($domainDetails['exdate']))->format('Y-m-d\TH:i:s.v\Z');
|
||||||
|
|
||||||
// Check if the domain exists
|
// Check if the domain exists
|
||||||
if (!$domainDetails) {
|
if (!$domainDetails) {
|
||||||
// Domain not found, respond with a 404 error
|
// Domain not found, respond with a 404 error
|
||||||
|
|
|
@ -329,16 +329,20 @@ $server->on('receive', function ($server, $fd, $reactorId, $data) use ($c, $pdo)
|
||||||
|
|
||||||
// Perform the WHOIS lookup
|
// Perform the WHOIS lookup
|
||||||
try {
|
try {
|
||||||
$query = "SELECT *,
|
$query = "SELECT * FROM `registry`.`domain` WHERE `name` = :domain";
|
||||||
DATE_FORMAT(`crdate`, '%Y-%m-%dT%H:%i:%sZ') AS `crdate`,
|
|
||||||
DATE_FORMAT(`update`, '%Y-%m-%dT%H:%i:%sZ') AS `update`,
|
|
||||||
DATE_FORMAT(`exdate`, '%Y-%m-%dT%H:%i:%sZ') AS `exdate`
|
|
||||||
FROM `registry`.`domain` WHERE `name` = :domain";
|
|
||||||
$stmt = $pdo->prepare($query);
|
$stmt = $pdo->prepare($query);
|
||||||
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
$stmt->bindParam(':domain', $domain, PDO::PARAM_STR);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
||||||
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
if ($f = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
$f['crdate'] = (new DateTime($f['crdate']))->format('Y-m-d\TH:i:s.v\Z');
|
||||||
|
if (isset($f['update']) && $f['update'] !== null) {
|
||||||
|
$f['update'] = (new DateTime($f['update']))->format('Y-m-d\TH:i:s.v\Z');
|
||||||
|
} else {
|
||||||
|
$f['update'] = '';
|
||||||
|
}
|
||||||
|
$f['exdate'] = (new DateTime($f['exdate']))->format('Y-m-d\TH:i:s.v\Z');
|
||||||
|
|
||||||
$query2 = "SELECT `tld` FROM `domain_tld` WHERE `id` = :tldid";
|
$query2 = "SELECT `tld` FROM `domain_tld` WHERE `id` = :tldid";
|
||||||
$stmt2 = $pdo->prepare($query2);
|
$stmt2 = $pdo->prepare($query2);
|
||||||
$stmt2->bindParam(':tldid', $f['tldid'], PDO::PARAM_INT);
|
$stmt2->bindParam(':tldid', $f['tldid'], PDO::PARAM_INT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue