/** * Deletes the keyword with the given id * * @param int $id the keywordID * @return int returns 1 on success, 0 else * * @todo should we now increment the tcversion also? **/ function deleteKeyword($id) { $result = tl::ERROR; $keyword = $this->getKeyword($id); if ($keyword) { $result = tlDBObject::deleteObjectFromDB($this->db, $id, "tlKeyword"); } if ($result >= tl::OK) { logAuditEvent(TLS("audit_keyword_deleted", $keyword->name), "DELETE", $id, "keywords"); } return $result; }
/** * Deletes the keyword with the given id * * @param int $id the keywordID * @return int returns 1 on success, 0 else * **/ function deleteKeyword($id, $opt = null) { $result = tl::ERROR; $my['opt'] = array('checkBeforeDelete' => true, 'nameForAudit' => null, 'context' => ''); $my['opt'] = array_merge($my['opt'], (array) $opt); $doIt = !$my['opt']['checkBeforeDelete']; $keyword = $my['opt']['nameForAudit']; if ($my['opt']['checkBeforeDelete']) { $kw = $this->getKeyword($id); if ($doIt = !is_null($kw)) { $keyword = $kw->name; } } if ($doIt) { $result = tlDBObject::deleteObjectFromDB($this->db, $id, "tlKeyword"); } if ($result >= tl::OK && $this->auditCfg->logEnabled) { logAuditEvent(TLS("audit_keyword_deleted", $keyword, $my['opt']['context']), "DELETE", $id, "keywords"); } return $result; }