undo mark as non-duplicate

This commit is contained in:
Manuel Kamper 2022-10-31 20:27:08 +00:00
parent 875ba3896b
commit 5e0386b0ec
1 changed files with 24 additions and 0 deletions

View File

@ -69,6 +69,30 @@ if (isset($_GET['insertDuplicate'])) {
} else {
response(902, "Error: You have to provide 'duplicateId' to mark a file pair as non-duplicate!");
}
} else if (isset($_GET['undoDuplicate'])) {
$data = json_decode(file_get_contents('php://input'), true);
$duplicateId = trim($data['duplicateId'] ?? '');
if ($duplicateId != "") {
if (ctype_digit($duplicateId)) {
try {
$st = $db->prepare("DELETE FROM no_duplicates WHERE id = ?;");
$st->execute(array($duplicateId));
if ($st->rowCount()) {
response(200, "Removed successfully the mark as non-duplicate.");
} else {
response(940, "Error: duplicateId not found in database or pair is not marked as non-duplicate.");
}
} catch (PDOException $e) {
response(999, "Database Error: " . $e->getMessage());
die();
}
} else {
response(906, "Error: Variable 'duplicateId' has to be an integer value!");
}
} else {
response(902, "Error: You have to provide 'duplicateId' to mark a file pair as non-duplicate!");
}
} else if(isset($_GET['isDuplicate'])) {
$data = json_decode(file_get_contents('php://input'), true);
$duplicateId = trim($data['duplicateId'] ?? '');