cfmgrv4 init...10

This commit is contained in:
최준흠 2026-02-11 10:36:26 +09:00
parent b9cfd457b5
commit 9cba30297e

View File

@ -11,6 +11,7 @@ use App\Models\Cloudflare\ZoneModel;
use App\Services\Cloudflare\RecordService;
use CodeIgniter\HTTP\RedirectResponse;
use App\Services\MyLogService;
use RuntimeException;
class RecordController extends CloudflareController
{
@ -81,41 +82,45 @@ class RecordController extends CloudflareController
}
protected function create_process(): void
{
//DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨
$this->formDatas = $this->create_validate($this->action, $this->fields);
//Type이 A형식일경우 IP형태인지 확인
if ($this->formDatas['type'] === 'A') {
if (!$this->helper->isIPAddress($this->formDatas['content'], $this->formDatas['type'])) {
throw new \Exception("{$this->formDatas['type']}, {$this->formDatas['content']} 형식 오류[사설IP 않됨]");
try {
//DB작업도 Socket에서 다 처리하므로 parent::create_process()하면 않됨
$this->formDatas = $this->create_validate($this->action, $this->fields);
//Type이 A형식일경우 IP형태인지 확인
if ($this->formDatas['type'] === 'A') {
if (!$this->helper->isIPAddress($this->formDatas['content'], $this->formDatas['type'])) {
throw new \Exception("{$this->formDatas['type']}, {$this->formDatas['content']} 형식 오류[사설IP 않됨]");
}
}
}
//호스트명 형식확인
$hosts = explode("\n", $this->formDatas['hosts']);
if (!is_array($hosts) || !count($hosts)) {
throw new \Exception("호스트명이 정의되지 않았습니다.");
}
$cnt = 1;
foreach ($hosts as $host) {
if (!$this->helper->isHost($host)) {
throw new \Exception("입력하신 {$cnt}번째 : [{$host}]는 호스트명 입력형식에 맞지 않습니다.");
//호스트명 형식확인
$hosts = explode("\n", $this->formDatas['hosts']);
if (!is_array($hosts) || !count($hosts)) {
throw new \Exception("호스트명이 정의되지 않았습니다.");
}
$cnt++;
$cnt = 1;
foreach ($hosts as $host) {
if (!$this->helper->isHost($host)) {
throw new \Exception("입력하신 {$cnt}번째 : [{$host}]는 호스트명 입력형식에 맞지 않습니다.");
}
$cnt++;
}
//Socket처리
//부모데이터정의
$this->_zone_entity = $this->getParentEntity($this->formDatas[$this->getService()->getModel()::PARENT]);
$entitys = [];
foreach ($hosts as $host) {
$entity = $this->getService()->create(
$this->_zone_entity,
$host,
$this->formDatas['type'],
$this->formDatas['content'],
$this->formDatas['proxied']
);
$entitys[] = $entity;
}
$this->entitys = $entitys;
} catch (\Throwable $e) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류:" . $e->getMessage());
}
//Socket처리
//부모데이터정의
$this->_zone_entity = $this->getParentEntity($this->formDatas[$this->getService()->getModel()::PARENT]);
$entitys = [];
foreach ($hosts as $host) {
$entity = $this->getService()->create(
$this->_zone_entity,
$host,
$this->formDatas['type'],
$this->formDatas['content'],
$this->formDatas['proxied']
);
$entitys[] = $entity;
}
$this->entitys = $entitys;
}
//수정 (modify,toggle,batchjob사용)
protected function modify_process(mixed $uid): void