From 73b0ab2f51033f777f9215e6838edf7ed0def4f0 Mon Sep 17 00:00:00 2001 From: Pinga <121483313+getpinga@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:52:23 +0200 Subject: [PATCH] Further enhancements --- automation/config.php.dist | 1 + automation/reporting.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/automation/config.php.dist b/automation/config.php.dist index 6af0b2d..372d332 100644 --- a/automation/config.php.dist +++ b/automation/config.php.dist @@ -24,6 +24,7 @@ return [ 'escrow_report_password' => 'your_password', // Reporting Configuration + 'reporting_path' => '/opt/reporting', 'reporting_upload' => false, 'reporting_username' => 'your_username', 'reporting_password' => 'your_password', diff --git a/automation/reporting.php b/automation/reporting.php index eac261e..6a5fafe 100644 --- a/automation/reporting.php +++ b/automation/reporting.php @@ -21,6 +21,11 @@ $query = "SELECT tld FROM domain_tld"; $tlds = $dbh->query($query)->fetchAll(PDO::FETCH_COLUMN); foreach ($tlds as $tld) { + // Skip TLDs with a dot inside, apart from the beginning + if (strpos(substr($tld, 1), '.') !== false) { + continue; // Skip this iteration if an additional dot is found + } + // Initialize activity and transaction data arrays for each TLD $activityData = []; $transactionData = []; @@ -158,8 +163,8 @@ foreach ($tlds as $tld) { // Write data to CSV $tld_save = strtolower(ltrim($tld, '.')); - writeCSV("/tmp/{$tld_save}-activity-" . date('Ym') . "-en.csv", $activityData); - writeCSV("/tmp/{$tld_save}-transactions-" . date('Ym') . "-en.csv", $transactionData); + writeCSV("{$c['reporting_path']}/{$tld_save}-activity-" . date('Ym') . "-en.csv", $activityData); + writeCSV("{$c['reporting_path']}/{$tld_save}-transactions-" . date('Ym') . "-en.csv", $transactionData); // Upload if the $c['reporting_upload'] variable is true if ($c['reporting_upload']) {