From 529eeaebe6482940c50867a7e2f551aa17acf569 Mon Sep 17 00:00:00 2001 From: Kai Schwarz Date: Mon, 16 May 2022 09:58:02 +0200 Subject: [PATCH] test(debug possibilities): regarding "problematic" tld imports --- .../keysystems/lib/Helpers/ZoneInfo.php | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/modules/registrars/keysystems/lib/Helpers/ZoneInfo.php b/modules/registrars/keysystems/lib/Helpers/ZoneInfo.php index 26c9e57..70c6b6a 100644 --- a/modules/registrars/keysystems/lib/Helpers/ZoneInfo.php +++ b/modules/registrars/keysystems/lib/Helpers/ZoneInfo.php @@ -48,7 +48,7 @@ public static function get(array $params, ?string $tld = null): ZoneModel } } - //$zone = null; + // $zone = null; if (!$zone || ($updateNeeded && $updates < $maxUpdates)) { try { $zoneInfo = new GetZoneInfo($params, $tld); @@ -60,27 +60,29 @@ public static function get(array $params, ?string $tld = null): ZoneModel throw new Exception($ex->getMessage()); } - //$p1 = explode(",",$zoneInfo->api->properties['REGISTRATIONPERIODS'][0]); - //$p2 = explode(",",$zoneInfo->api->properties['RENEWALPERIODS'][0]); - //$diff = array_diff($p1, $p2); - - // if ( - // empty(array_intersect($p1, $p2)) - // || empty(array_intersect($p2, $p1)) - //) { - // logActivity($tld . ": " . json_encode([ - // "registration" => $p1, - // "renewal" => $p2 - // ], JSON_PRETTY_PRINT)); - //} - // 2022-05: - // no renewal terms: .xin, .sc.ke, .net.vu,.mobi.ke, .me.ke, .edu.mt, .com.vu, .ac.ni, .ac.ke - // different terms: .tm, .org.gi, .net.bd, .hu, .gi - // n/a as term: .nl, .li, .jp, .it, .de, .ch - - //if (!empty($diff)) { - // logActivity($tld . ": " . json_encode($diff, JSON_PRETTY_PRINT)); - //} + /*$p1 = explode(",",$zoneInfo->api->properties['REGISTRATIONPERIODS'][0]); + $p2 = explode(",",$zoneInfo->api->properties['RENEWALPERIODS'][0]); + $dbgRow = [ + "registration" => $p1, + "renewal" => $p2, + "unsupportedRenewalTerms" => array_values(array_diff($p1, $p2)), // all elements of p1 not in p2 + "missingRenewalTerms" => array_values(array_diff($p2, $p1)) // all elements of p2 not in p1 + ]; + $flag1 = empty($dbgRow["unsupportedRenewalTerms"]); + $flag2 = empty($dbgRow["missingRenewalTerms"]); + if ( + (!( + !$flag1 + // 10y reg only -> whmcs keeps 10y for renewal otherwise not + && count($dbgRow["registration"])>1 + && count($dbgRow["unsupportedRenewalTerms"]) === 1 + && in_array(10, $dbgRow["unsupportedRenewalTerms"]) + ) && !$flag1) + || !$flag2 + ) { + //$debugPeriodIssues[$tld] = $dbgRow; + logActivity(json_encode([$tld => $dbgRow], JSON_PRETTY_PRINT)); + }*/ // 2022-05: plenty of tlds having reg terms that are not supported for renewal $data = [