cfmgrv4 init...4
This commit is contained in:
parent
e35a278b72
commit
89090aafd5
@ -3,11 +3,8 @@
|
|||||||
namespace App\Controllers\CLI;
|
namespace App\Controllers\CLI;
|
||||||
|
|
||||||
use App\Controllers\BaseController;
|
use App\Controllers\BaseController;
|
||||||
use App\Entities\Cloudflare\AccountEntity;
|
use App\Models\Cloudflare\AccountModel;
|
||||||
use App\Entities\Cloudflare\AuthEntity;
|
|
||||||
use App\Entities\Cloudflare\ZoneEntity;
|
|
||||||
use App\Models\Cloudflare\AuthModel;
|
use App\Models\Cloudflare\AuthModel;
|
||||||
use App\Models\Cloudflare\RecordModel;
|
|
||||||
use App\Models\Cloudflare\ZoneModel;
|
use App\Models\Cloudflare\ZoneModel;
|
||||||
use App\Services\Cloudflare\AccountService;
|
use App\Services\Cloudflare\AccountService;
|
||||||
use App\Services\Cloudflare\AuditLogService;
|
use App\Services\Cloudflare\AuditLogService;
|
||||||
@ -114,9 +111,11 @@ class Cloudflare extends BaseController
|
|||||||
if ($domain !== "") {
|
if ($domain !== "") {
|
||||||
$zone_model->where(['domain' => $domain]);
|
$zone_model->where(['domain' => $domain]);
|
||||||
}
|
}
|
||||||
|
$account_model = model(AccountModel::class);
|
||||||
$zone = new ZoneService();
|
$zone = new ZoneService();
|
||||||
foreach ($zone_model->getEntitys() as $entity) {
|
foreach ($zone_model->getEntitys() as $entity) {
|
||||||
$zone->expire($entity);
|
$account_entity = $account_model->getEntity($entity->getParent());
|
||||||
|
$zone->expire($account_entity, $entity);
|
||||||
}
|
}
|
||||||
log_message("notice", "Expire 작업을 완료하였습니다.");
|
log_message("notice", "Expire 작업을 완료하였습니다.");
|
||||||
// $this->_db->transCommit();
|
// $this->_db->transCommit();
|
||||||
|
|||||||
@ -5,7 +5,6 @@ namespace App\Services\Cloudflare;
|
|||||||
use App\Entities\Cloudflare\AccountEntity;
|
use App\Entities\Cloudflare\AccountEntity;
|
||||||
use App\Entities\Cloudflare\ZoneEntity;
|
use App\Entities\Cloudflare\ZoneEntity;
|
||||||
use App\Models\Cloudflare\ZoneModel;
|
use App\Models\Cloudflare\ZoneModel;
|
||||||
use Iodev\Whois\Factory;
|
|
||||||
|
|
||||||
class ZoneService extends CloudflareService
|
class ZoneService extends CloudflareService
|
||||||
{
|
{
|
||||||
@ -159,17 +158,16 @@ class ZoneService extends CloudflareService
|
|||||||
// log_message("debug", $this->getModel()->getLastQuery());
|
// log_message("debug", $this->getModel()->getLastQuery());
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
public function expire(ZoneEntity $entity): void
|
public function expire(AccountEntity $parent_entity, ZoneEntity $entity): ZoneEntity
|
||||||
{
|
{
|
||||||
$whois = Factory::get()->createWhois();
|
$this->setParentEntity($parent_entity);
|
||||||
if ($whois->isDomainAvailable($entity->getTitle())) {
|
$response = $this->getMySocket()->get("accounts/{$entity->getPK()}/registrar/{$entity->getTitle()}");
|
||||||
$info = $whois->loadDomainInfo($entity->getTitle());
|
$body = json_decode($response->getBody());
|
||||||
$expire_date = date("Y-m-d", $info->expirationDate);
|
$formDatas = ['expire_date', $body->result->expires_at];
|
||||||
$this->getModel()->modify($entity, ['expire_date' => $expire_date]);
|
// log_message("debug", var_export($formDatas, true));
|
||||||
log_message('debug', __FUNCTION__ . " : {$entity->getTitle()} => {$expire_date}");
|
$entity = $this->getModel()->modify($entity, $formDatas);
|
||||||
} else {
|
// log_message("debug", $this->getModel()->getLastQuery());
|
||||||
log_message('debug', "{$entity->getTitle()} 이 도메인은 등록되지 않았습니다.");
|
return $entity;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Reload
|
//Reload
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
"codeigniter4/framework": "^4.5",
|
"codeigniter4/framework": "^4.5",
|
||||||
"google/apiclient": "^2.15.0",
|
"google/apiclient": "^2.15.0",
|
||||||
"guzzlehttp/guzzle": "^7.9",
|
"guzzlehttp/guzzle": "^7.9",
|
||||||
"io-developer/php-whois": "4.0",
|
"io-developer/php-whois": "^4.1",
|
||||||
"phpoffice/phpspreadsheet": "^1.27",
|
"phpoffice/phpspreadsheet": "^1.27",
|
||||||
"symfony/css-selector": "^7.1",
|
"symfony/css-selector": "^7.1",
|
||||||
"symfony/dom-crawler": "^7.1",
|
"symfony/dom-crawler": "^7.1",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user