X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FTag.php;h=45824bbc1a4567f10b0855cfef4e63260e0e4f25;hb=f81192b4c3838480154301ac25cbbbed58593380;hp=1645dc1255b540a9f66742b3c987f6a7bd93e78b;hpb=b731f8a0ad467a7f99da893b8b4ec068068a5603;p=friendica.git diff --git a/src/Model/Tag.php b/src/Model/Tag.php index 1645dc1255..45824bbc1a 100644 --- a/src/Model/Tag.php +++ b/src/Model/Tag.php @@ -25,13 +25,12 @@ use Friendica\Content\Text\BBCode; use Friendica\Core\Cache\Enum\Duration; use Friendica\Core\Logger; use Friendica\Core\Protocol; -use Friendica\Core\System; use Friendica\Database\Database; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Protocol\ActivityPub; use Friendica\Util\DateTimeFormat; -use Friendica\Util\Network; +use Friendica\Util\HTTPSignature; use Friendica\Util\Strings; /** @@ -112,7 +111,7 @@ class Tag } if ((substr($url, 0, 7) == 'https//') || (substr($url, 0, 6) == 'http//')) { - Logger::notice('Wrong scheme in url', ['url' => $url, 'callstack' => System::callstack(20)]); + Logger::notice('Wrong scheme in url', ['url' => $url]); } $cid = Contact::getIdForURL($url, 0, false); @@ -159,7 +158,7 @@ class Tag DBA::insert('post-tag', $fields, Database::INSERT_IGNORE); - Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]); + Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type]); } /** @@ -197,7 +196,7 @@ class Tag $target = self::ACCOUNT; Logger::debug('URL is an account', ['url' => $url]); } elseif ($fetch && ($target != self::GENERAL_COLLECTION)) { - $content = ActivityPub::fetchContent($url); + $content = HTTPSignature::fetch($url); if (!empty($content['type']) && ($content['type'] == 'OrderedCollection')) { $target = self::GENERAL_COLLECTION; Logger::debug('URL is an ordered collection', ['url' => $url]); @@ -316,7 +315,7 @@ class Tag */ public static function storeFromArray(array $item, string $tags = null) { - Logger::info('Check for tags', ['uri-id' => $item['uri-id'], 'hash' => $tags, 'callstack' => System::callstack()]); + Logger::info('Check for tags', ['uri-id' => $item['uri-id'], 'hash' => $tags]); if (is_null($tags)) { $tags = self::TAG_CHARACTER[self::HASHTAG] . self::TAG_CHARACTER[self::MENTION] . self::TAG_CHARACTER[self::EXCLUSIVE_MENTION]; @@ -347,7 +346,7 @@ class Tag */ public static function storeRawTagsFromBody(int $uriId, string $body) { - Logger::info('Check for tags', ['uri-id' => $uriId, 'callstack' => System::callstack()]); + Logger::info('Check for tags', ['uri-id' => $uriId]); $result = BBCode::getTags($body); if (empty($result)) { @@ -396,7 +395,7 @@ class Tag return; } - Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url, 'callstack' => System::callstack(8)]); + Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url]); DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]); } @@ -828,12 +827,13 @@ class Tag public static function getUIDListByURIId(int $uriId): array { $uids = []; - $tags = self::getByURIId($uriId, [self::HASHTAG]); - foreach ($tags as $tag) { - $uids = array_merge($uids, self::getUIDListByTag(self::TAG_CHARACTER[self::HASHTAG] . $tag['name'])); + foreach (self::getByURIId($uriId, [self::HASHTAG]) as $tag) { + foreach (self::getUIDListByTag(self::TAG_CHARACTER[self::HASHTAG] . $tag['name']) as $uid) { + $uids[$uid][] = $tag['name']; + } } - return array_unique($uids); + return $uids; } }