diff --git a/app/Controllers/Admin/Cloudflare/AccountController.php b/app/Controllers/Admin/Cloudflare/AccountController.php index a2cbb53..55f8fe2 100644 --- a/app/Controllers/Admin/Cloudflare/AccountController.php +++ b/app/Controllers/Admin/Cloudflare/AccountController.php @@ -81,8 +81,8 @@ class AccountController extends CloudflareController { //부모데이터정의 $this->auth_entity = $this->getAuthModel()->getEntityByPK($uid); - if ($this->auth_entity === null) { - throw new \Exception("Auth: {$uid} 정보를 찾을수 없습니다."); + if ($this->_zone_entity === null) { + throw new \Exception("Auth: [{$uid}] 정보를 찾을수 없습니다."); } $this->getService()->reload($this->auth_entity); } diff --git a/app/Controllers/Admin/Cloudflare/FirewallController.php b/app/Controllers/Admin/Cloudflare/FirewallController.php index f448dd4..1ff9ea2 100644 --- a/app/Controllers/Admin/Cloudflare/FirewallController.php +++ b/app/Controllers/Admin/Cloudflare/FirewallController.php @@ -72,6 +72,9 @@ class FirewallController extends CloudflareController } //부모데이터정의 $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); + if ($this->_zone_entity === null) { + throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다."); + } //Socket처리 $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); if ($this->_zone_entity === null) { - throw new \Exception("Zone: {$uid} 정보를 찾을수 없습니다."); + throw new \Exception("Zone: [{$uid}] 정보를 찾을수 없습니다."); } $this->getService()->reload($this->_zone_entity); } diff --git a/app/Controllers/Admin/Cloudflare/RecordController.php b/app/Controllers/Admin/Cloudflare/RecordController.php index 63bf1c9..6eea834 100644 --- a/app/Controllers/Admin/Cloudflare/RecordController.php +++ b/app/Controllers/Admin/Cloudflare/RecordController.php @@ -94,6 +94,9 @@ class RecordController extends CloudflareController //Socket처리 //부모데이터정의 $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 = []; foreach ($hosts as $host) { $entity = $this->getService()->create( @@ -135,6 +138,9 @@ class RecordController extends CloudflareController } //부모데이터정의 $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent()); + if ($this->_zone_entity === null) { + throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다."); + } //Socket처리 $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()); + if ($this->_zone_entity === null) { + throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다."); + } //Cloudflare 삭제 $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()); + if ($this->_zone_entity === null) { + throw new \Exception("Zone: [{$this->entity->getParent()}] 정보를 찾을수 없습니다."); + } //Socket처리 $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); if ($this->_zone_entity === null) { - throw new \Exception("Zone: {$uid} 정보를 찾을수 없습니다."); + throw new \Exception("Zone: [{$uid}] 정보를 찾을수 없습니다."); } $this->getService()->reload($this->_zone_entity); } diff --git a/app/Controllers/Admin/Cloudflare/ZoneController.php b/app/Controllers/Admin/Cloudflare/ZoneController.php index b338cf2..ed29fe4 100644 --- a/app/Controllers/Admin/Cloudflare/ZoneController.php +++ b/app/Controllers/Admin/Cloudflare/ZoneController.php @@ -80,6 +80,12 @@ class ZoneController extends CloudflareController { //DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨 $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형태인지 확인 if ($this->formDatas['type'] === 'A') { @@ -117,8 +123,6 @@ class ZoneController extends CloudflareController $cnt++; } //Socket처리 - //부모데이터 정의 - $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]); //Zone생성 $cnt = 1; $entitys = []; @@ -173,6 +177,9 @@ class ZoneController extends CloudflareController } //부모데이터정의 $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent()); + if ($this->_account_entity === null) { + throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다."); + } //Socket처리 $this->entity = $this->getService()->modify($this->_account_entity, $this->entity, $this->formDatas); } @@ -212,6 +219,9 @@ class ZoneController extends CloudflareController //Zone 삭제 //부모데이터정의 $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); } // 리스트 @@ -265,6 +275,9 @@ class ZoneController extends CloudflareController } //부모데이터정의 $this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent()); + if ($this->_account_entity === null) { + throw new \Exception("Account: [{$this->entity->getParent()}] 정보를 찾을수 없습니다."); + } //Socket처리 $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); if ($this->_account_entity === null) { - throw new \Exception("Account: {$uid} 정보를 찾을수 없습니다."); + throw new \Exception("Account: [{$uid}] 정보를 찾을수 없습니다."); } $this->getService()->reload($this->_account_entity); }