if ($hostname && !in_array($hostname, (array)$post_delete)) { if ($host_as_attr && FQDN::IsSubdomain($hostname, $Domain->GetHostName())) { $nslist[] = new NameserverHost($hostname, $post_ns_ip[$k]); } else { $nslist[] = new Nameserver($hostname); } } } try { $Action = new UpdateDomainNameserversAction($Domain, $nslist); $result = $Action->Run($_SESSION['userid']); if ($result == UpdateDomainNameserversAction_Result::OK) { $okmsg = _("Nameserver list successfully updated"); } else if ($result == UpdateDomainNameserversAction_Result::PENDING) { $okmsg = _("Nameservers change request has been sent to registry. You will be notified by email as soon as this operation will be completed."); } } catch (UpdateDomainNameserversAction_Exception $e) { if ($e->getCode() == UpdateDomainNameserversAction_Exception::NAMESERVERHOST_NOT_REGISTERED) { $errmsg = $e->getMessage() . " " . _("You can create it <a href='nhosts_view.php'>here</a>.");
function Handle(Task $Task) { $Job = $Task->JobObject; // Load registry for TLD $RegFactory = RegistryModuleFactory::GetInstance(); $Registry = $RegFactory->GetRegistryByExtension($Job->TLD); // For each target load domain and update nameservers $DbDomain = DBDomain::GetInstance(); foreach ($Task->GetActiveTargets() as $Target) { try { $Domain = $DbDomain->LoadByName($Target->target, $Job->TLD); $Action = new UpdateDomainNameserversAction($Domain, $Job->nslist); $Action->Run($Task->userid); $Task->TargetCompleted($Target); } catch (Exception $e) { $Target->fail_reason = $e->getMessage(); Log::Log(sprintf(_("Update failed for %s. %s"), "{$Target->target}.{$Job->TLD}", $e->getMessage())); $Task->TargetFailed($Target); } } }