From e4b8b9736d02f3efe64bcf50f8f9b0762be9b05e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Tue, 22 Oct 2024 17:12:53 +0900 Subject: [PATCH] cfmgrv4 init...3 --- app/Controllers/CLI/Cloudflare.php | 5 +++++ app/Services/Cloudflare/Firewall.php | 4 ++-- app/Services/Cloudflare/Record.php | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/Controllers/CLI/Cloudflare.php b/app/Controllers/CLI/Cloudflare.php index 2cb8874..a4cfc58 100644 --- a/app/Controllers/CLI/Cloudflare.php +++ b/app/Controllers/CLI/Cloudflare.php @@ -65,9 +65,14 @@ class Cloudflare extends BaseController $accounts = $this->account_process($auth); foreach (array_values($accounts) as $account) { $zones = $this->zone_process($account); + $cnt = 1; + $total = count($zones); foreach (array_values($zones) as $zone) { + log_message("notice", "\n-----------[{$cnt}/$total}] Zone {$zone->getTitle()}의 Record/Firewall 처리 시작-----------"); $records = $this->record_process($zone); $firewalls = $this->firewall_process($zone); + log_message("notice", "\n-----------[{$cnt}/$total}] Zone {$zone->getTitle()}의 Record/Firewall 처리 완료-----------"); + $cnt++; } } } diff --git a/app/Services/Cloudflare/Firewall.php b/app/Services/Cloudflare/Firewall.php index 551ade6..2037c26 100644 --- a/app/Services/Cloudflare/Firewall.php +++ b/app/Services/Cloudflare/Firewall.php @@ -85,7 +85,7 @@ class Firewall extends Cloudflare //Reload public function reload(): array { - log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Firewall 처리 시작-----------"); + // log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Firewall 처리 시작-----------"); $entitys = []; try { $response = $this->getMySocket()->get("zones/{$this->getParentEntity()->getPK()}/rulesets/phases/http_request_firewall_custom/entrypoint"); @@ -105,7 +105,7 @@ class Firewall extends Cloudflare log_message("error", $e->getMessage()); // throw new \Exception($e->getMessage()); } - log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Firewall처리[" . count($entitys) . "개] 완료-----------"); + // log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Firewall처리[" . count($entitys) . "개] 완료-----------"); return $entitys; } } diff --git a/app/Services/Cloudflare/Record.php b/app/Services/Cloudflare/Record.php index 1fd11d1..d822d43 100644 --- a/app/Services/Cloudflare/Record.php +++ b/app/Services/Cloudflare/Record.php @@ -140,7 +140,7 @@ class Record extends Cloudflare //Reload public function reload(): array { - log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Record 처리 시작-----------"); + // log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Record 처리 시작-----------"); $entitys = []; try { $results = $this->reload_procedure("zones/{$this->getParentEntity()->getPK()}/dns_records"); @@ -167,7 +167,7 @@ class Record extends Cloudflare log_message("error", $e->getMessage()); throw new \Exception($e->getMessage()); } - log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Record처리[" . count($entitys) . "개] 완료-----------"); + // log_message("notice", "\n-----------Zone {$this->getParentEntity()->getTitle()}의 Record처리[" . count($entitys) . "개] 완료-----------"); return $entitys; } }