当前位置: 首页>>代码示例>>PHP>>正文


PHP Domain::HasPendingOperation方法代码示例

本文整理汇总了PHP中Domain::HasPendingOperation方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::HasPendingOperation方法的具体用法?PHP Domain::HasPendingOperation怎么用?PHP Domain::HasPendingOperation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Domain的用法示例。


在下文中一共展示了Domain::HasPendingOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Run

 /**
  * Executor
  *
  * @throws UpdateDomainContactTask_Exception
  */
 public function Run($userid = null)
 {
     try {
         $Factory = RegistryModuleFactory::GetInstance();
         $Registry = $Factory->GetRegistryByExtension($this->Domain->Extension);
         $Manifest = $Registry->GetManifest();
         if ($userid && $this->Domain->UserID != $userid) {
             throw new UpdateDomainContactAction_Exception(_("You don't have permissions for manage this domain"), UpdateDomainContactAction_Exception::DOMAIN_NOT_BELONGS_TO_USER);
         }
         $OldContact = $this->Domain->GetContact($this->contact_type);
         if ($this->NewContact && $this->NewContact->UserID != $this->Domain->UserID) {
             throw new UpdateDomainContactAction_Exception(_("You don't have permissions for using this contact"), UpdateDomainContactAction_Exception::CONTACT_NOT_BELONGS_TO_USER);
         }
         $trade = $Manifest->GetRegistryOptions()->ability->trade == '1';
         if ($this->contact_type != CONTACT_TYPE::REGISTRANT || !$trade) {
             try {
                 $Registry->UpdateDomainContact($this->Domain, $this->contact_type, $OldContact, $this->NewContact);
                 return $this->Domain->HasPendingOperation(Registry::OP_UPDATE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
             } catch (Exception $e) {
                 throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
             }
         } else {
             // Execute trade when:
             // - Trade invoice is paid
             // - Previous trade failed
             if ($this->Domain->IncompleteOrderOperation == INCOMPLETE_OPERATION::DOMAIN_TRADE || $this->Invoice && $this->Invoice->Status == INVOICE_STATUS::PAID) {
                 $this->Domain->SetContact($this->NewContact, CONTACT_TYPE::REGISTRANT);
                 $this->Domain->IncompleteOrderOperation = null;
                 $extra["requesttype"] = "ownerChange";
                 try {
                     $trade = $Registry->ChangeDomainOwner($this->Domain, 1, $extra);
                     return $this->Domain->HasPendingOperation(Registry::OP_TRADE) ? UpdateDomainContactAction_Result::PENDING : UpdateDomainContactAction_Result::OK;
                 } catch (Exception $e) {
                     $this->Domain->IncompleteOrderOperation = INCOMPLETE_OPERATION::DOMAIN_TRADE;
                     if ($this->Invoice) {
                         $this->Invoice->ActionStatus = INVOICE_ACTION_STATUS::FAILED;
                         $this->Invoice->ActionFailReason = $e->getMessage();
                     }
                     throw new UpdateDomainContactAction_Exception(sprintf(_("Cannot change contact. Reason: %s"), $e->getMessage()));
                 }
             } else {
                 // Issue an invoice for trade operation
                 $invoiceid = $this->Db->GetOne("SELECT * FROM invoices WHERE status=? AND itemid=? AND purpose=?", array(INVOICE_STATUS::PENDING, $this->Domain->ID, INVOICE_PURPOSE::DOMAIN_TRADE));
                 if (!$invoiceid) {
                     $this->Domain->SetExtraField("NewRegistrantCLID", $this->NewContact->CLID);
                     DBDomain::GetInstance()->Save($this->Domain);
                     $Invoice = new Invoice(INVOICE_PURPOSE::DOMAIN_TRADE, $this->Domain->ID, $userid);
                     $Invoice->Description = sprintf(_("%s domain name trade"), $this->Domain->GetHostName());
                     $Invoice->Save();
                     $this->Invoice = $Invoice;
                     return UpdateDomainContactAction_Result::INVOICE_GENERATED;
                 } else {
                     throw new UpdateDomainContactAction_Exception(_("Another domain trade is already initiated"));
                 }
             }
         }
     } catch (Exception $e) {
         throw new UpdateDomainContactAction_Exception($e->getMessage());
     }
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:65,代码来源:class.UpdateDomainContactAction.php

示例2: Run

 public function Run($userid)
 {
     try {
         $Factory = RegistryModuleFactory::GetInstance();
         $Registry = $Factory->GetRegistryByExtension($this->Domain->Extension);
         $host_as_attr = (bool) $Registry->GetManifest()->GetRegistryOptions()->ability->hostattr;
     } catch (Exception $e) {
         throw new UpdateDomainNameserversAction_Exception(sprintf(_("Cannot change nameservers. Reason: %s"), $e->getMessage()));
     }
     // Check that all nameserver hosts are registered
     foreach ($this->nslist as &$NS) {
         $glue_record = preg_match("/^(.*)\\.{$this->Domain->GetHostName()}\$/", $NS->HostName, $matches);
         if ($glue_record) {
             $known_ns = $this->Db->GetRow("SELECT * FROM nhosts WHERE hostname=? AND domainid=?", array($matches[1], $this->Domain->ID));
             if (!$known_ns) {
                 if ($host_as_attr) {
                     // No need to register nameserver hosts
                     $this->Db->Execute("INSERT INTO nhosts SET domainid = ?, hostname = ?, ipaddr = ?", array($this->Domain->ID, $matches[1], $NS->IPAddr));
                 } else {
                     throw new UpdateDomainNameserversAction_Exception(sprintf(_("Nameserver %s does not exist"), $NS->HostName), UpdateDomainNameserversAction_Exception::NAMESERVERHOST_NOT_REGISTERED);
                 }
             } else {
                 $NS = new NameserverHost($NS->HostName, $host_as_attr ? $NS->IPAddr : $known_ns['ipaddr']);
                 $NS->ID = $known_ns['id'];
             }
         }
     }
     // Perform nameservers update
     try {
         $Changes = new Changelist($this->Domain->GetNameserverList(), $this->nslist);
         $Registry->UpdateDomainNameservers($this->Domain, $Changes);
         $DBNSHost = DBNameserverHost::GetInstance();
         $DBNSHost->SaveList($this->Domain->GetNameserverHostList(), $this->Domain->ID);
         return $this->Domain->HasPendingOperation(Registry::OP_UPDATE) ? UpdateDomainNameserversAction_Result::PENDING : UpdateDomainNameserversAction_Result::OK;
     } catch (Exception $e) {
         throw new UpdateDomainNameserversAction_Exception(sprintf(_("Cannot change nameservers. Reason: %s"), $e->getMessage()));
     }
 }
开发者ID:rchicoria,项目名称:epp-drs,代码行数:38,代码来源:class.UpdateDomainNameserversAction.php


注:本文中的Domain::HasPendingOperation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。