We now store the tags in two separate tables

This commit is contained in:
Michael 2020-04-17 06:35:20 +00:00
parent d3f4e4d629
commit db657b0149
8 changed files with 121 additions and 98 deletions

View file

@ -2464,26 +2464,7 @@ class DFRN
$item["tag"] .= $termhash . "[url=" . $termurl . "]" . $term . "[/url]";
// Store the hashtag/mention
$fields = ['uri-id' => $item['uri-id'], 'name' => substr($term, 0, 64)];
if ($termhash == Term::TAG_CHARACTER[Term::MENTION]) {
$fields['type'] = Term::MENTION;
} elseif ($termhash == Term::TAG_CHARACTER[Term::EXCLUSIVE_MENTION]) {
$fields['type'] = Term::EXCLUSIVE_MENTION;
} elseif ($termhash == Term::TAG_CHARACTER[Term::IMPLICIT_MENTION]) {
$fields['type'] = Term::IMPLICIT_MENTION;
} elseif ($termhash == Term::TAG_CHARACTER[Term::HASHTAG]) {
$fields['type'] = Term::HASHTAG;
}
if (!empty($termurl)) {
$fields['url'] = $termurl;
}
DBA::insert('tag', $fields, true);
Logger::info('Stored tag/mention', ['uri-id' => $item['uri-id'], 'tag' => $term, 'url' => $termurl, 'hash' => $termhash, 'fields' => $fields]);
Tag::storeByHash($item['uri-id'], $termhash, $term, $termurl);
}
}
}