andre 6 сар өмнө
parent
commit
5801d8a59a

+ 42 - 0
core/Helper/DnsHelper.php

@@ -250,5 +250,47 @@ class DnsHelper
         } */
         return 'success';
     }
+    function KerioEmail_unsetMX($params)
+    {
+        $zoneIDcollection = Capsule::table('dns_manager2_zone')
+            ->select('id')
+            ->where('name', '=', $this->params['domain'])
+            ->get();
+        $zoneIDobj = $zoneIDcollection[0];
+        $zoneID = $zoneIDobj->{'id'};
+        if(!isset($zoneID)) {
+            return 'Error: zone ID not found for domain ' . $this->params['domain'];
+        }
+        $dnsZone = localAPI('dnsmanager', array( 'dnsaction' => 'getZone', 'zone_id' => $zoneID));
+        if($dnsZone['result'] != 'success') {
+            return 'Error: cloud not fetch zone for ID ' . $zoneID;
+        }
+        $zoneRecords = array();
+        foreach($dnsZone['data']->records as $record) {
+            if($record->type == 'MX') continue;
+            array_push($zoneRecords, $record);
+        }
+
+
+        logModuleCall(
+            'kerioEmail',
+            __FUNCTION__,
+            $this->params,
+            'DEbug',
+            $zoneRecords
+        );
+
+/*        $result = localAPI('dnsmanager' ,
+            array(
+                'dnsaction' => 'updateZone',
+                'zone_id' => $zoneID,
+                'records' => $zoneRecords,
+            )
+        );
+        if($result['result'] != 'success') {
+            return 'Error: cloud not update zone for ID ' . $zoneID;
+        } */
+        return 'success';
+}
 
 }