cfmgrv4 init...4

This commit is contained in:
최준흠 2024-10-27 21:13:12 +09:00
parent cd62171712
commit 09f70ade85
4 changed files with 83 additions and 78 deletions

View File

@ -1,47 +1,47 @@
<?php <?php
return [ return [
'title' => "Record정보", 'title' => "Record정보",
'label' => [ 'label' => [
'uid' => "번호", 'uid' => "번호",
'zone_uid' => "도메인", 'zone_uid' => "도메인",
'type' => "Type", 'type' => "Type",
'host' => "호스트명", 'host' => "호스트명",
'content' => "IP정보", 'content' => "IP정보",
'ttl' => "TTL", 'ttl' => "TTL",
'proxiable' => "proxiable", 'proxiable' => "proxiable",
'fixed' => "CDN잠금", 'fixed' => "CDN잠금",
'proxied' => "CDN사용여부", 'proxied' => "CDN사용여부",
'locked' => "서비스", 'locked' => "서비스",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
'hosts' => "호스트명", 'hosts' => "호스트명",
], ],
"ZONE_UID" => [], "ZONE_UID" => [],
"TYPE" => [ "TYPE" => [
'A' => 'A', 'A' => 'A',
'CNAME' => 'CNAME', 'CNAME' => 'CNAME',
'NS' => 'NS', 'NS' => 'NS',
'MX' => 'MX', 'MX' => 'MX',
'PTR' => 'PTR', 'PTR' => 'PTR',
'SPF' => 'SPF', 'SPF' => 'SPF',
'TXT' => 'TXT', 'TXT' => 'TXT',
'SRV' => 'SRV', 'SRV' => 'SRV',
'INFO' => 'INFO', 'INFO' => 'INFO',
], ],
"FIXED" => [ "FIXED" => [
"on" => "고정", "on" => "고정",
"off" => "비고정", "off" => "비고정",
], ],
"PROXIABLE" => [ "PROXIABLE" => [
"on" => "사용", "on" => "사용",
"off" => "사용 않함", "off" => "사용 않함",
], ],
"PROXIED" => [ "PROXIED" => [
"on" => "CDN 사용", "on" => "CDN 사용",
"off" => "CDN 미사용", "off" => "CDN 미사용",
], ],
"LOCKED" => [ "LOCKED" => [
"on" => "운영중", "on" => "운영중",
"off" => "잠김", "off" => "잠김",
], ],
]; ];

View File

@ -1,62 +1,62 @@
<?php <?php
return [ return [
'title' => "Zone정보", 'title' => "Zone정보",
'label' => [ 'label' => [
'uid' => "번호", 'uid' => "번호",
'account_uid' => "계정", 'account_uid' => "계정",
'domain' => "도메인", 'domain' => "도메인",
'name_servers' => "네임서버", 'name_servers' => "네임서버",
'original_name_servers' => "이전네임서버", 'original_name_servers' => "이전네임서버",
'plan' => "plan", 'plan' => "plan",
'development_mode' => "개발모드", 'development_mode' => "개발모드",
'ipv6' => "ipv6", 'ipv6' => "ipv6",
'security_level' => "공격방어", 'security_level' => "공격방어",
'ssl_mode' => "SSL모드", 'ssl_mode' => "SSL모드",
'always_use_https' => "https사용", 'always_use_https' => "https사용",
'status' => "서비스", 'status' => "서비스",
'updated_at' => "수정일", 'updated_at' => "수정일",
'created_at' => "작성일", 'created_at' => "작성일",
'domains' => "도메인명", 'domains' => "도메인명",
'hosts' => "호스트명", 'hosts' => "호스트명",
'type' => "TYPE", 'type' => "TYPE",
'content' => "IP정보", 'content' => "IP정보",
'proxied' => "CDN기능", 'proxied' => "CDN기능",
], ],
"ACCOUNT_UID" => [], "ACCOUNT_UID" => [],
"DEVELOPMENT_MODE" => [ "DEVELOPMENT_MODE" => [
"on" => "사용", "on" => "사용",
"off" => "사용않함", "off" => "사용않함",
], ],
"PLAN" => [ "PLAN" => [
"Free Website" => "Free", "Free Website" => "Free",
"Pro Website" => "Pro", "Pro Website" => "Pro",
"Business Website" => "Business", "Business Website" => "Business",
], ],
"IPV6" => [ "IPV6" => [
"on" => "사용", "on" => "사용",
"off" => "사용않함", "off" => "사용않함",
], ],
"SECURITY_LEVEL" => [ "SECURITY_LEVEL" => [
"under_attack" => "under_attack", "under_attack" => "under_attack",
"medium" => "medium", "medium" => "medium",
"low" => "low", "low" => "low",
"essentially_off" => "essentially_off", "essentially_off" => "essentially_off",
], ],
"ALWAYS_USE_HTTPS" => [ "ALWAYS_USE_HTTPS" => [
"on" => "사용", "on" => "사용",
"off" => "사용않함", "off" => "사용않함",
], ],
"SSL_MODE" => [ "SSL_MODE" => [
"off" => "off", "off" => "off",
"flexible" => "flexible", "flexible" => "flexible",
"full" => "full", "full" => "full",
"strict" => "strict", "strict" => "strict",
"origin_pull" => "origin_pull" "origin_pull" => "origin_pull"
], ],
"STATUS" => [ "STATUS" => [
"initializing" => "initializing", "initializing" => "initializing",
"pending" => "pending", "pending" => "pending",
"active" => "active", "active" => "active",
"moved" => "moved" "moved" => "moved"
], ],
]; ];

View File

@ -168,7 +168,7 @@ class RecordService extends CloudflareService
$entitys = []; $entitys = [];
try { try {
$results = $this->reload_procedure("zones/{$this->getParentEntity()->getPK()}/dns_records"); $results = $this->reload_procedure("zones/{$this->getParentEntity()->getPK()}/dns_records");
$total = count($results); $total = count($results);
if ($total > 0) { if ($total > 0) {
$cnt = 1; $cnt = 1;
foreach ($results as $result) { foreach ($results as $result) {

View File

@ -170,19 +170,24 @@ class ZoneService extends CloudflareService
$entitys = []; $entitys = [];
try { try {
$results = $this->reload_procedure("zones"); $results = $this->reload_procedure("zones");
$cnt = 1; $cnt = 1;
$total = count($results); $total = count($results);
if ($total > 0) { if ($total > 0) {
foreach ($results as $result) { foreach ($results as $result) {
if (!is_object($result) || get_class($result) !== 'stdClass') { if (!is_object($result) || get_class($result) !== 'stdClass') {
throw new \Exception("Zone: result is not a stdClass:\n" . var_export($result, true) . "\n"); log_message("error", "Zone: result is not a stdClass:\n" . var_export($result, true) . "\n");
continue;
}
if (isset($result->status) && $result->status === 'active') {
$formDatas = $this->getArrayByResult($result);
$formDatas = $this->getCFSetting($formDatas[ZoneModel::PK], $formDatas);
$entity = $this->getModel()->modify(new ZoneEntity(), $formDatas);
log_message("debug", "{$cnt}/{$total} => {$entity->getTitle()} Zone 처리,[{$this->getMySocket()::$_request}]");
$entitys[$entity->getPK()] = $entity;
$cnt++;
} else {
log_message("error", "Zone is abnomral status:\n" . var_export($result, true) . "\n");
} }
$formDatas = $this->getArrayByResult($result);
$formDatas = $this->getCFSetting($formDatas[ZoneModel::PK], $formDatas);
$entity = $this->getModel()->modify(new ZoneEntity(), $formDatas);
log_message("debug", "{$cnt}/{$total} => {$entity->getTitle()} Zone 처리,[{$this->getMySocket()::$_request}]");
$entitys[$entity->getPK()] = $entity;
$cnt++;
} }
//부모키를 기준으로 CF에 존재하지 않는 데이터 삭제용 //부모키를 기준으로 CF에 존재하지 않는 데이터 삭제용
$this->getModel()->where(ZoneModel::PARENT, value: $this->getParentEntity()->getPK()); $this->getModel()->where(ZoneModel::PARENT, value: $this->getParentEntity()->getPK());