public function deleteTagItem($r) { $u = $this->user; $u->expireDataCache($r->getCache()); $tag_item = new Dase_DBO_TagItem($this->db); $tag_item->load($r->get('tag_item_id')); $tag = new Dase_DBO_Tag($this->db); $tag->load($tag_item->tag_id); //todo: make this tag->eid == $u->eid if ($tag->dase_user_id == $u->id) { $tag_item->delete(); $tag->updateItemCount(); $r->renderResponse("tag item " . $r->get('tag_item_id') . " deleted!", false); } else { $r->renderError(401, 'user does not own tag'); } }
function removeItem($item_unique, $update_count = false) { $tag_item = new Dase_DBO_TagItem($this->db); $tag_item->tag_id = $this->id; list($coll, $sernum) = explode('/', $item_unique); //todo: compat $item = Dase_DBO_Item::get($this->db, $coll, $sernum); $tag_item->item_id = $item->id; $tag_item->p_collection_ascii_id = $coll; $tag_item->p_serial_number = $sernum; if ($tag_item->findOne()) { $log_text = "removing {$item_unique} from set {$this->eid}/{$this->ascii_id}"; Dase_Log::info(LOG_FILE, $log_text); $tag_item->delete(); //this is too expensive when many items are being removed in one request if ($update_count) { $this->updateItemCount(); } } }