_db = \Config\Database::connect(); } public function reload(mixed $uid = false): void { //Transaction Start // $this->_db->transStart(); try { $auth_model = model(AuthModel::class); if (is_numeric($uid) && $uid > 0) { $auth_model->where(AuthModel::PK, intval($uid)); } else { $auth_model->where('status', DEFAULTS["STATUS"]); } $auth_entitys = $auth_model->getEntitys(); foreach ($auth_entitys as $auth_entity) { $account = new AccountService(); $account_entitys = $account->reload($auth_entity); foreach (array_values($account_entitys) as $account_entity) { $zone = new ZoneService(); $record = new RecordService(); $firewall = new FirewallService(); $zone_entitys = $zone->reload($account_entity); $cnt = 1; $total = count($zone_entitys); foreach (array_values($zone_entitys) as $zone_entity) { log_message("notice", "\n-----------[{$cnt}/$total}] Zone {$zone_entity->getTitle()}의 Record/Firewall 처리 시작-----------"); $record->reload($zone_entity); $firewall->reload($zone_entity); log_message("notice", "\n-----------[{$cnt}/$total}] Zone {$zone_entity->getTitle()}의 Record/Firewall 처리 완료-----------"); $cnt++; } } } log_message("notice", "Reload 작업을 완료하였습니다."); // $this->_db->transCommit(); } catch (\Exception $e) { //Transaction Rollback // $this->_db->transRollback(); log_message( "error", "Reload 작업을 실패하였습니다.\n--------------\n" . $e->getMessage() . "\n--------------\n" ); } } }