Beispiel #1
0
 /**
  * Fetch all pending operations
  *
  * @return PendingOperation[]
  */
 public function GetPendingOperationList($object_type = null, $object_id = null)
 {
     // Domain operations
     if ($object_type && $object_id) {
         // XXX
         $arr = $this->DB->GetAll("\r\n\t\t\t\t\tSELECT p.* FROM pending_operations as p \r\n\t\t\t\t\tINNER JOIN domains as d ON (p.objectid = d.id AND p.objecttype = ?) \r\n\t\t\t\t\tWHERE d.TLD = ? AND p.objecttype = ? AND p.objectid = ?\r\n\t\t\t\t\t\r\n\t\t\t\t\tUNION\r\n\t\t\t\t\t\r\n\t\t\t\t\tSELECT p.* FROM pending_operations as p\r\n\t\t\t\t\tINNER JOIN contacts AS c ON (p.objectid = c.id AND p.objecttype = ?)\r\n\t\t\t\t\tWHERE (c.TLD = ? OR c.module_name = ?) AND p.objecttype = ? AND p.objectid = ?\r\n\t\t\t\t\t", array(self::OBJ_DOMAIN, $this->RegModule->Extension, $object_type, $object_id, self::OBJ_CONTACT, $this->RegModule->Extension, $this->RegModule->ModuleName, $object_type, $object_id));
     } else {
         $arr = $this->DB->GetAll("\r\n\t\t\t\t\tSELECT p.* FROM pending_operations as p \r\n\t\t\t\t\tINNER JOIN domains as d ON (p.objectid = d.id AND p.objecttype = ?) \r\n\t\t\t\t\tWHERE d.TLD = ?\r\n\t\t\t\t\t\r\n\t\t\t\t\tUNION\r\n\t\t\t\t\t\r\n\t\t\t\t\tSELECT p.* FROM pending_operations as p\r\n\t\t\t\t\tINNER JOIN contacts AS c ON (p.objectid = c.id AND p.objecttype = ?)\r\n\t\t\t\t\tWHERE (c.TLD = ? OR c.module_name = ?)\r\n\t\t\t\t\t", array(self::OBJ_DOMAIN, $this->RegModule->Extension, self::OBJ_CONTACT, $this->RegModule->Extension, $this->RegModule->ModuleName));
     }
     $ret = array();
     foreach ($arr as $row) {
         try {
             $op = new PendingOperation();
             $op->ID = $row['id'];
             $op->Type = $row['operation'];
             $op->InitDate = strtotime($row['dtbegin']);
             $op->RegistryOpId = $row['registry_opid'];
             $op->ObjectBefore = unserialize($row["object_before"]);
             $op->ObjectAfter = unserialize($row["object_after"]);
             if ($row['objecttype'] == self::OBJ_DOMAIN) {
                 $op->Object = $this->DBDomain->Load($row['objectid']);
             } else {
                 if ($row['objecttype'] == self::OBJ_CONTACT) {
                     $op->Object = $this->DBContact->Load($row['objectid']);
                 } else {
                     continue;
                 }
             }
             $ret[] = $op;
         } catch (Exception $e) {
             Log::Log('Fetch pending operation object failed: ' . $e->getMessage(), E_USER_ERROR);
         }
     }
     return $ret;
 }