cfmgrv4 init...4
This commit is contained in:
parent
35d0782065
commit
3361dd891d
@ -105,42 +105,19 @@ class Cloudflare extends BaseController
|
||||
);
|
||||
}
|
||||
}
|
||||
public function expire(string $domain): void
|
||||
public function expire(string $domain = ""): void
|
||||
{
|
||||
//Transaction Start
|
||||
// $this->_db->transStart();
|
||||
try {
|
||||
$zone_model = model(ZoneModel::class);
|
||||
$zone_model->where(['domain' => $domain]);
|
||||
$zone_entity = $zone_model->getEntity();
|
||||
$zone = new ZoneService();
|
||||
$zone->expire($zone_entity);
|
||||
log_message("notice", "Expire 작업을 완료하였습니다.");
|
||||
// $this->_db->transCommit();
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
// $this->_db->transRollback();
|
||||
log_message(
|
||||
"error",
|
||||
"Expire 작업을 실패하였습니다.\n--------------\n" .
|
||||
$e->getMessage() .
|
||||
"\n--------------\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function hosts(string $ip): void
|
||||
{
|
||||
//Transaction Start
|
||||
// $this->_db->transStart();
|
||||
try {
|
||||
$record_model = model(RecordModel::class);
|
||||
$record_model->where(['content' => $ip]);
|
||||
$hosts = [];
|
||||
foreach ($record_model->getEntitys() as $entity) {
|
||||
$hosts[] = $entity->host;
|
||||
if ($domain !== "") {
|
||||
$zone_model->where(['domain' => $domain]);
|
||||
}
|
||||
$zone = new ZoneService();
|
||||
foreach ($zone_model->getEntitys() as $entity) {
|
||||
$zone->expire($entity);
|
||||
}
|
||||
echo implode("\n", $hosts);
|
||||
log_message("notice", "Expire 작업을 완료하였습니다.");
|
||||
// $this->_db->transCommit();
|
||||
} catch (\Exception $e) {
|
||||
|
||||
@ -159,15 +159,12 @@ class ZoneService extends CloudflareService
|
||||
// log_message("debug", $this->getModel()->getLastQuery());
|
||||
return $entity;
|
||||
}
|
||||
public function expire(ZoneEntity $entity)
|
||||
public function expire(ZoneEntity $entity): void
|
||||
{
|
||||
$whois = Factory::get()->createWhois();
|
||||
$info = $whois->loadDomainInfo($entity->getTitle());
|
||||
print_r([
|
||||
'Domain created' => date("Y-m-d", $info->creationDate),
|
||||
'Domain expires' => date("Y-m-d", $info->expirationDate),
|
||||
'Domain owner' => $info->owner,
|
||||
]);
|
||||
$formDatas = ['expire_date' => date("Y-m-d", $info->expirationDate)];
|
||||
$this->getModel()->modify($entity, $formDatas);
|
||||
}
|
||||
|
||||
//Reload
|
||||
|
||||
Loading…
Reference in New Issue
Block a user