/** * delete * * Delete the tag and all maps */ public function delete() { $sql = "DELETE FROM `tag_map` WHERE `tag_map`.`tag_id`='" . $this->id . "'"; Dba::write($sql); $sql = "DELETE FROM `tag` WHERE `tag`.`id`='" . $this->id . "'"; Dba::write($sql); // Call the garbage collector to clean everything Tag::gc(); parent::clear_cache(); }
/** * delete * * Delete the tag and all maps */ public function delete() { $sql = "DELETE FROM `tag_map` WHERE `tag_map`.`tag_id` = ?"; Dba::write($sql, array($this->id)); $sql = "DELETE FROM `tag_merge` " . "WHERE `tag_merge`.`tag_id` = ?"; Dba::write($sql, array($this->id)); $sql = "DELETE FROM `tag` WHERE `tag`.`id` = ? "; Dba::write($sql, array($this->id, $this->id)); // Call the garbage collector to clean everything Tag::gc(); parent::clear_cache(); }
/** * update_all * This takes a preference id and a value and updates all users with the new info */ public static function update_all($preference_id, $value) { $preference_id = Dba::escape($preference_id); $value = Dba::escape($value); $sql = "UPDATE `user_preference` SET `value`='{$value}' WHERE `preference`='{$preference_id}'"; Dba::write($sql); parent::clear_cache(); return true; }