/** * Add pending operation for registry * * @param stdClass $object Domain|Contact|NameserverHost * @param string $op_type self::OP_* */ public function AddPendingOperation($object, $op_type, $registry_op_id = null) { if ($object instanceof Domain) { $object_type = self::OBJ_DOMAIN; try { $old_object = $this->DBDomain->GetInitialState($object); } catch (Exception $e) { $old_object = null; } } else { if ($object instanceof Contact) { $object_type = self::OBJ_CONTACT; try { $old_object = $this->DBContact->GetInitialState($object); } catch (Exception $e) { $old_object = null; } } else { throw new Exception(_('Invalid argument $object')); } } $this->DB->Execute('INSERT INTO pending_operations SET registry_opid = ?, objectid = ?, dtbegin=NOW(), operation=?, objecttype=?, object_before=?, object_after=?', array($registry_op_id, $object->ID, $op_type, $object_type, serialize($old_object), serialize($object))); if ($object instanceof Domain || $object instanceof Contact) { $object->AddPendingOperation($op_type); } }