function DispatchPollDeleteContact(PollDeleteContactResponse $resp) { if ($resp->IsFailed()) { Log::Log(sprintf('DispatchContactDeleted failed. Registry response: %s', $resp->ErrMsg), E_USER_ERROR); throw new Exception($resp->ErrMsg, $resp->Code); } $contact = $this->DBContact->LoadByCLID($resp->CLID); $this->DBContact->Delete($contact); $this->FireEvent('ContactDeleted', $contact); }
private function CreateObject($row, RegistryManifest $registry_manifest = null) { /* if ($registry_manifest == null) { $registry = RegistryModuleFactory::GetInstance()->GetRegistryByExtension($row['TLD']); $registry_manifest = $registry->GetManifest(); unset($registry); } */ // TODO // ���������� ���������� �� ������������ ������, ���� ������� ���� �������� // ��������� ������� Domain // $registry = RegistryModuleFactory::GetInstance()->GetRegistryByExtension($row['TLD']); if (!$registry) { throw new Exception(sprintf(_("Registry module not defined for '%s' domain extension"), $row['TLD'])); } $domain = $registry->NewDomainInstance(); $registry_manifest = $registry->GetManifest(); //unset($registry); // Normalize DB data $row['start_date'] = strtotime($row['start_date']); $row['end_date'] = strtotime($row['end_date']); $row['dtTransfer'] = strtotime($row['dtTransfer']); $row["islocked"] = (bool) $row["islocked"]; $row['managed_dns'] = (bool) $row['managed_dns']; // Normalize nameservers data $ns_arr = array(); if ($row['ns1']) { $ns_arr[] = $row['ns1']; } if ($row['ns2']) { $ns_arr[] = $row['ns2']; } if ($row['ns_n']) { $ns_n = array_map('trim', explode(';', $row['ns_n'])); foreach ($ns_n as $hostname) { $ns_arr[] = $hostname; } } // Load glue records $arr = $this->DB->GetAll('SELECT * FROM nhosts WHERE domainid = ?', array($row['id'])); $glue_records = array(); foreach ($arr as $tmp) { $glue_records["{$tmp['hostname']}.{$row['name']}.{$row['TLD']}"] = $tmp; } // Create nameservers list $nslist = array(); foreach ($ns_arr as $hostname) { // Check that nameserver is glue record. if (FQDN::IsSubdomain($hostname, "{$row["name"]}.{$row["TLD"]}") && array_key_exists($hostname, $glue_records)) { $nshost = new NameserverHost($hostname, $glue_records[$hostname]['ipaddr']); $nshost->ID = $glue_records[$hostname]['id']; $nslist[] = $nshost; } else { $nslist[] = new Nameserver($hostname); } } // Map fields to properties foreach ($this->FieldPropertyMap as $field => $property) { $domain->{$property} = $row[$field]; } // Set nameservers $domain->SetNameserverList($nslist); // Load extra fields $extra_fields = $this->DB->GetAll('SELECT `key`, `value` FROM domains_data WHERE domainid = ?', array($domain->ID)); foreach ($extra_fields as $ext_row) { $domain->{$ext_row['key']} = $ext_row['value']; $domain->SetExtraField($ext_row['key'], $ext_row['value']); } // Load flags $flags_data = $this->DB->GetAll('SELECT DISTINCT flag FROM domains_flags WHERE domainid = ?', array($domain->ID)); $flag_list = array(); foreach ($flags_data as $flag_row) { $flag_list[] = $flag_row['flag']; } $domain->SetFlagList($flag_list); // Load contacts foreach ($this->ContactFieldTypeMap as $field => $contact_type) { $CLID = $row[$field]; if ($CLID) { try { $contact = $this->DBContact->LoadByCLID($CLID, $registry_manifest); } catch (Exception $e) { $contact = $registry->NewContactInstance($contact_type); $contact->CLID = $CLID; } $domain->SetContact($contact, $contact_type); } } // Add pending operations to domain $operations = $this->DB->Execute("SELECT * FROM pending_operations WHERE objecttype='DOMAIN' AND objectid=?", array($domain->ID)); while ($op = $operations->FetchRow()) { if ($op) { $domain->AddPendingOperation($op["operation"]); } } // Add domain to loaded objects storage $this->LoadedObjects[$domain->ID] = clone $domain; return $domain; }