56 lines
1.9 KiB
PHP
56 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Controllers\Cloudflare;
|
|
|
|
use CodeIgniter\HTTP\RequestInterface;
|
|
use CodeIgniter\HTTP\ResponseInterface;
|
|
use Psr\Log\LoggerInterface;
|
|
use App\Models\Cloudflare\FirewallModel;
|
|
use App\Services\Cloudflare\Firewall;
|
|
|
|
class FirewallController extends CloudflareController
|
|
{
|
|
private $_zone_entity = null;
|
|
private $_myLibrays = [];
|
|
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
|
{
|
|
parent::initController($request, $response, $logger);
|
|
$this->class_name .= "Firewall";
|
|
$this->class_path .= $this->class_name;
|
|
$this->title = lang("{$this->class_path}.title");
|
|
}
|
|
final protected function getModel(): FirewallModel
|
|
{
|
|
if ($this->model === null) {
|
|
$this->model = new FirewallModel();
|
|
}
|
|
return $this->model;
|
|
}
|
|
final protected function getMyLibrary(): Firewall
|
|
{
|
|
if (!isset($this->_myLibrays[$this->_zone_entity->getPK()])) {
|
|
$this->_myLibrays[$this->_zone_entity->getPK()] = new Firewall($this->_zone_entity);
|
|
}
|
|
return $this->_myLibrays[$this->_zone_entity->getPK()];
|
|
}
|
|
//Trigger작업
|
|
protected function trigger_process(): void
|
|
{
|
|
parent::trigger_process();
|
|
// //자신정보정의
|
|
// $this->entity = $this->getModel()->getEntityByPK($uid);
|
|
// if ($this->entity === null) {
|
|
// throw new \Exception("{$uid} 정보를 찾을수 없습니다.");
|
|
// }
|
|
// //부모데이터정의
|
|
// $this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
|
|
// //Socket처리
|
|
// $this->entity = $this->getMyLibrary()->sync($this->entity);
|
|
log_message("notice", message: "Firewall Trigger 작업완료");
|
|
}
|
|
public function trigger(): ResponseInterface
|
|
{
|
|
return $this->trigger_procedure();
|
|
}
|
|
}
|