mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-23 02:56:02 +02:00
The DB error log is usable again, updates to match structure
This commit is contained in:
parent
483554762a
commit
b43483ed2f
8 changed files with 259 additions and 38 deletions
|
@ -1467,8 +1467,13 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
|||
$insertDomainHostMapStmt = $db->prepare("INSERT INTO domain_host_map (domain_id,host_id) VALUES(:domain_id,:host_id)");
|
||||
$insertDomainHostMapStmt->execute([':domain_id' => $domain_id, ':host_id' => $hostObj_already_exist]);
|
||||
} else {
|
||||
$errorLogStmt = $db->prepare("INSERT INTO error_log (registrar_id,log,date) VALUES(:registrar_id,:log,CURRENT_TIMESTAMP(3))");
|
||||
$errorLogStmt->execute([':registrar_id' => $clid, ':log' => "Domain : $domainName ; hostObj : $hostObj - is duplicated"]);
|
||||
$errorLogStmt = $db->prepare("INSERT INTO error_log
|
||||
(channel, level, level_name, message, context, extra, created_at)
|
||||
VALUES ('epp', 3, 'warning', :log, :context, '{}', CURRENT_TIMESTAMP)");
|
||||
$errorLogStmt->execute([
|
||||
':log' => "Domain: $domainName; hostObj: $hostObj - is duplicated",
|
||||
':context' => json_encode(['registrar_id' => $clid, 'domain' => $domainName, 'host' => $hostObj])
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
$internal_host = false;
|
||||
|
@ -1532,8 +1537,13 @@ function processDomainCreate($conn, $db, $xml, $clid, $database_type, $trans, $m
|
|||
$stmt->execute([$domain_id, $hostName_already_exist]);
|
||||
} else {
|
||||
// Log duplicate mapping error
|
||||
$stmt = $db->prepare("INSERT INTO error_log (registrar_id, log, date) VALUES (?, ?, CURRENT_TIMESTAMP(3))");
|
||||
$stmt->execute([$clid, "Domain: $domainName ; hostName: $hostName - duplicate mapping"]);
|
||||
$stmt = $db->prepare("INSERT INTO error_log
|
||||
(channel, level, level_name, message, context, extra, created_at)
|
||||
VALUES ('epp', 3, 'warning', ?, ?, '{}', CURRENT_TIMESTAMP)");
|
||||
$stmt->execute([
|
||||
"Domain: $domainName; hostName: $hostName - duplicate mapping",
|
||||
json_encode(['registrar_id' => $clid, 'domain' => $domainName, 'host' => $hostName])
|
||||
]);
|
||||
}
|
||||
} else {
|
||||
// Insert a new host
|
||||
|
|
|
@ -1529,11 +1529,16 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
$stmt = $db->prepare("INSERT INTO error_log (registrar_id,log,date) VALUES(:registrar_id, :log, CURRENT_TIMESTAMP(3))");
|
||||
$log = "Domain : $domainName ; hostObj : $hostObj - is duplicated";
|
||||
$stmt->bindParam(':registrar_id', $clid, PDO::PARAM_INT);
|
||||
$stmt->bindParam(':log', $log, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
$logMessage = "Domain: $domainName; hostObj: $hostObj - is duplicated";
|
||||
$contextData = json_encode([
|
||||
'registrar_id' => $clid,
|
||||
'domain' => $domainName,
|
||||
'host' => $hostObj
|
||||
]);
|
||||
$stmt = $db->prepare("INSERT INTO error_log
|
||||
(channel, level, level_name, message, context, extra, created_at)
|
||||
VALUES ('epp', 3, 'warning', ?, ?, '{}', CURRENT_TIMESTAMP)");
|
||||
$stmt->execute([$logMessage, $contextData]);
|
||||
}
|
||||
} else {
|
||||
$host_from_this_registry = 0;
|
||||
|
@ -1625,9 +1630,16 @@ function processDomainUpdate($conn, $db, $xml, $clid, $database_type, $trans) {
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
$logMessage = "Domain : $domainName ; hostName : $hostName - is duplicated";
|
||||
$sth = $db->prepare("INSERT INTO error_log (registrar_id,log,date) VALUES(?, ?, CURRENT_TIMESTAMP(3))");
|
||||
if (!$sth->execute([$clid, $logMessage])) {
|
||||
$logMessage = "Domain: $domainName; hostName: $hostName - is duplicated";
|
||||
$contextData = json_encode([
|
||||
'registrar_id' => $clid,
|
||||
'domain' => $domainName,
|
||||
'host' => $hostName
|
||||
]);
|
||||
$sth = $db->prepare("INSERT INTO error_log
|
||||
(channel, level, level_name, message, context, extra, created_at)
|
||||
VALUES ('epp', 3, 'warning', ?, ?, '{}', CURRENT_TIMESTAMP)");
|
||||
if (!$sth->execute([$logMessage, $contextData])) {
|
||||
sendEppError($conn, $db, 2400, 'Database error', $clTRID, $trans);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue