cfmgrv4 init...4

This commit is contained in:
최준흠 2024-10-29 17:24:47 +09:00
parent f95318aeb6
commit 95ac22ec14
4 changed files with 35 additions and 7 deletions

View File

@ -81,8 +81,8 @@ class AccountController extends CloudflareController
{ {
//부모데이터정의 //부모데이터정의
$this->auth_entity = $this->getAuthModel()->getEntityByPK($uid); $this->auth_entity = $this->getAuthModel()->getEntityByPK($uid);
if ($this->auth_entity === null) { if ($this->_zone_entity === null) {
throw new \Exception("Auth: {$uid} 정보를 찾을수 없습니다."); throw new \Exception("Auth: [{$uid}] 정보를 찾을수 없습니다.");
} }
$this->getService()->reload($this->auth_entity); $this->getService()->reload($this->auth_entity);
} }

View File

@ -72,6 +72,9 @@ class FirewallController extends CloudflareController
} }
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
if ($this->_zone_entity === null) {
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
//Socket처리 //Socket처리
$this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas); $this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas);
} }
@ -130,7 +133,7 @@ class FirewallController extends CloudflareController
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($uid); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($uid);
if ($this->_zone_entity === null) { if ($this->_zone_entity === null) {
throw new \Exception("Zone: {$uid} 정보를 찾을수 없습니다."); throw new \Exception("Zone: [{$uid}] 정보를 찾을수 없습니다.");
} }
$this->getService()->reload($this->_zone_entity); $this->getService()->reload($this->_zone_entity);
} }

View File

@ -94,6 +94,9 @@ class RecordController extends CloudflareController
//Socket처리 //Socket처리
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
if ($this->_zone_entity === null) {
throw new \Exception("Zone: [{$this->formDatas[$this->getModel()::PARENT]}] 정보를 찾을수 없습니다.");
}
$entitys = []; $entitys = [];
foreach ($hosts as $host) { foreach ($hosts as $host) {
$entity = $this->getService()->create( $entity = $this->getService()->create(
@ -135,6 +138,9 @@ class RecordController extends CloudflareController
} }
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
if ($this->_zone_entity === null) {
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
//Socket처리 //Socket처리
$this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas); $this->entity = $this->getService()->modify($this->_zone_entity, $this->entity, $this->formDatas);
} }
@ -167,6 +173,9 @@ class RecordController extends CloudflareController
} }
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
if ($this->_zone_entity === null) {
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
//Cloudflare 삭제 //Cloudflare 삭제
$this->entity = $this->getService()->delete($this->_zone_entity, $this->entity); $this->entity = $this->getService()->delete($this->_zone_entity, $this->entity);
} }
@ -221,6 +230,9 @@ class RecordController extends CloudflareController
} }
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
if ($this->_zone_entity === null) {
throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
//Socket처리 //Socket처리
$this->entity = $this->getService()->sync($this->_zone_entity, $this->entity); $this->entity = $this->getService()->sync($this->_zone_entity, $this->entity);
} }
@ -234,7 +246,7 @@ class RecordController extends CloudflareController
//부모데이터정의 //부모데이터정의
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($uid); $this->_zone_entity = $this->getZoneModel()->getEntityByPK($uid);
if ($this->_zone_entity === null) { if ($this->_zone_entity === null) {
throw new \Exception("Zone: {$uid} 정보를 찾을수 없습니다."); throw new \Exception("Zone: [{$uid}] 정보를 찾을수 없습니다.");
} }
$this->getService()->reload($this->_zone_entity); $this->getService()->reload($this->_zone_entity);
} }

View File

@ -80,6 +80,12 @@ class ZoneController extends CloudflareController
{ {
//DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨 //DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨
$this->formDatas = $this->create_validate($this->action, $this->fields); $this->formDatas = $this->create_validate($this->action, $this->fields);
//부모데이터 정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
if ($this->_account_entity === null) {
throw new \Exception("Account: [{$this->formDatas[$this->getModel()::PARENT]}] 정보를 찾을수 없습니다.");
}
//데이터검증 //데이터검증
//Type이 A형식일경우 IP형태인지 확인 //Type이 A형식일경우 IP형태인지 확인
if ($this->formDatas['type'] === 'A') { if ($this->formDatas['type'] === 'A') {
@ -117,8 +123,6 @@ class ZoneController extends CloudflareController
$cnt++; $cnt++;
} }
//Socket처리 //Socket처리
//부모데이터 정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
//Zone생성 //Zone생성
$cnt = 1; $cnt = 1;
$entitys = []; $entitys = [];
@ -173,6 +177,9 @@ class ZoneController extends CloudflareController
} }
//부모데이터정의 //부모데이터정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent()); $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
if ($this->_account_entity === null) {
throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
//Socket처리 //Socket처리
$this->entity = $this->getService()->modify($this->_account_entity, $this->entity, $this->formDatas); $this->entity = $this->getService()->modify($this->_account_entity, $this->entity, $this->formDatas);
} }
@ -212,6 +219,9 @@ class ZoneController extends CloudflareController
//Zone 삭제 //Zone 삭제
//부모데이터정의 //부모데이터정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent()); $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
if ($this->_account_entity === null) {
throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
$this->entity = $this->getService()->delete($this->_account_entity, $this->entity); $this->entity = $this->getService()->delete($this->_account_entity, $this->entity);
} }
// 리스트 // 리스트
@ -265,6 +275,9 @@ class ZoneController extends CloudflareController
} }
//부모데이터정의 //부모데이터정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent()); $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
if ($this->_account_entity === null) {
throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다.");
}
//Socket처리 //Socket처리
$this->entity = $this->getService()->sync($this->_account_entity, $this->entity); $this->entity = $this->getService()->sync($this->_account_entity, $this->entity);
} }
@ -278,7 +291,7 @@ class ZoneController extends CloudflareController
//부모데이터정의 //부모데이터정의
$this->_account_entity = $this->getAccountModel()->getEntityByPK($uid); $this->_account_entity = $this->getAccountModel()->getEntityByPK($uid);
if ($this->_account_entity === null) { if ($this->_account_entity === null) {
throw new \Exception("Account: {$uid} 정보를 찾을수 없습니다."); throw new \Exception("Account: [{$uid}] 정보를 찾을수 없습니다.");
} }
$this->getService()->reload($this->_account_entity); $this->getService()->reload($this->_account_entity);
} }