]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Term.php
Update function calls
[friendica.git] / src / Model / Term.php
index 6c89b5d00fe17d88a5e112a0ee16565d0579eded..f62fced70904c81dffe384b6fe49c720e37c60bf 100644 (file)
@@ -76,7 +76,7 @@ class Term
                $message['tag'] = $tags;
 
                // Clean up all tags
-               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
+               self::deleteByItemId($itemid);
 
                if ($message['deleted']) {
                        return;
@@ -291,18 +291,19 @@ class Term
                return $return;
        }
 
-       /*
-        * Deletes all Tags from an item
+       /**
+        * Delete all tags from an item
+        * @param int itemid - choose from which item the tags will be removed
+        * @param array type - items type. default is [TERM_HASHTAG, TERM_MENTION]
         */
-       public static function deleteAllTags($itemid)
+       public static function deleteByItemId($itemid, $type = [TERM_HASHTAG, TERM_MENTION])
        {
-               $message = Item::selectFirst(['id'], ['id' => $itemid]);
-               if (!DBA::isResult($message)) {
+               if (empty($itemid)) {
                        return;
                }
 
                // Clean up all tags
-               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
+               DBA::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => $type]);
 
        }
 }