From 982690c195c9b378d72190f4a557caf8b8ae8a27 Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 28 Jul 2026 23:12:13 +0530 Subject: [PATCH] check_transaction_lookup.php: add optional operation filter + limit args --- check_transaction_lookup.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/check_transaction_lookup.php b/check_transaction_lookup.php index 6ff7359..7ac8d00 100644 --- a/check_transaction_lookup.php +++ b/check_transaction_lookup.php @@ -5,7 +5,8 @@ * Run from the CI4 project root on the server. Delete this file after use. * * Usage: - * php83 check_transaction_lookup.php + * php83 check_transaction_lookup.php [operation_filter] [limit] + * php83 check_transaction_lookup.php 10b01dd7-062b-4fc1-91f1-82b3b1491eb6 consent_reconcile */ $envPath = __DIR__ . '/.env'; @@ -46,14 +47,20 @@ if ($needle === '') { } $like = '%' . $mysqli->real_escape_string($needle) . '%'; +$opFilter = trim((string) ($argv[2] ?? '')); +$limit = (int) ($argv[3] ?? 20); +if ($limit <= 0) { + $limit = 20; +} -echo "\n=== abdm_hiu_workflows rows matching '{$needle}' (in request_json/response_json) ===\n"; +echo "\n=== abdm_hiu_workflows rows matching '{$needle}'" . ($opFilter !== '' ? " AND operation='{$opFilter}'" : '') . " (in request_json/response_json) ===\n"; +$opClause = $opFilter !== '' ? " AND operation = '" . $mysqli->real_escape_string($opFilter) . "'" : ''; $sql = "SELECT id, operation, workflow_state, status, http_code, is_retryable, consent_id, abha_address, transaction_id, last_error, created_at, updated_at FROM abdm_hiu_workflows - WHERE request_json LIKE '{$like}' OR response_json LIKE '{$like}' - OR transaction_id LIKE '{$like}' OR consent_id LIKE '{$like}' - ORDER BY id DESC LIMIT 20"; + WHERE (request_json LIKE '{$like}' OR response_json LIKE '{$like}' + OR transaction_id LIKE '{$like}' OR consent_id LIKE '{$like}'){$opClause} + ORDER BY id DESC LIMIT {$limit}"; $res = $mysqli->query($sql); if (! $res) { fwrite(STDERR, "Query failed: " . $mysqli->error . "\n");