From eb8237dd8963dd83d652881dbec9acf5a16f2ca2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 9 Jul 2022 07:32:32 -0400 Subject: [PATCH] Remove unused uid parameter in Item::newURI --- mod/item.php | 2 +- mod/photos.php | 6 +++--- mod/tagger.php | 2 +- src/Model/Event.php | 2 +- src/Model/Item.php | 11 +++++------ src/Model/Mail.php | 4 ++-- src/Module/Api/Mastodon/Statuses.php | 2 +- src/Module/Contact/Poke.php | 2 +- src/Protocol/ActivityPub/Transmitter.php | 2 +- src/Protocol/Feed.php | 2 +- 10 files changed, 17 insertions(+), 18 deletions(-) diff --git a/mod/item.php b/mod/item.php index 2bfdf07a3b..a840ea9ad9 100644 --- a/mod/item.php +++ b/mod/item.php @@ -525,7 +525,7 @@ function item_post(App $a) { $origin = $_REQUEST['origin']; } - $uri = Item::newURI($api_source ? $profile_uid : $uid, $guid); + $uri = Item::newURI($guid); // Fallback so that we alway have a parent uri if (!$thr_parent_uri || !$toplevel_item_id) { diff --git a/mod/photos.php b/mod/photos.php index 745cea30ce..bd9762882e 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -360,7 +360,7 @@ function photos_post(App $a) if (DBA::isResult($photos) && !$item_id) { // Create item container $title = ''; - $uri = Item::newURI($page_owner_uid); + $uri = Item::newURI(); $arr = []; $arr['guid'] = System::createUUID(); @@ -524,7 +524,7 @@ function photos_post(App $a) if (count($taginfo)) { foreach ($taginfo as $tagged) { - $uri = Item::newURI($page_owner_uid); + $uri = Item::newURI(); $arr = []; $arr['guid'] = System::createUUID(); @@ -728,7 +728,7 @@ function photos_post(App $a) $smallest = 2; } - $uri = Item::newURI($page_owner_uid); + $uri = Item::newURI(); // Create item container $lat = $lon = null; diff --git a/mod/tagger.php b/mod/tagger.php index 1acce4b0b6..e674efba69 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -73,7 +73,7 @@ function tagger_content(App $a) { return; } - $uri = Item::newURI($owner_uid); + $uri = Item::newURI(); $xterm = XML::escape($term); $post_type = (($item['resource-id']) ? DI::l10n()->t('photo') : DI::l10n()->t('status')); $targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE ); diff --git a/src/Model/Event.php b/src/Model/Event.php index f63ec3d559..74bf3bd9c0 100644 --- a/src/Model/Event.php +++ b/src/Model/Event.php @@ -248,7 +248,7 @@ class Event $event['uid'] = intval($arr['uid'] ?? 0); $event['cid'] = intval($arr['cid'] ?? 0); $event['guid'] = ($arr['guid'] ?? '') ?: System::createUUID(); - $event['uri'] = ($arr['uri'] ?? '') ?: Item::newURI($event['uid'], $event['guid']); + $event['uri'] = ($arr['uri'] ?? '') ?: Item::newURI($event['guid']); $event['uri-id'] = ItemURI::insert(['uri' => $event['uri'], 'guid' => $event['guid']]); $event['type'] = ($arr['type'] ?? '') ?: 'event'; $event['summary'] = $arr['summary'] ?? ''; diff --git a/src/Model/Item.php b/src/Model/Item.php index bf3ca49dbc..01ea942c86 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -780,7 +780,7 @@ class Item $uid = intval($item['uid']); $item['guid'] = self::guid($item, $notify); - $item['uri'] = substr(trim($item['uri'] ?? '') ?: self::newURI($item['uid'], $item['guid']), 0, 255); + $item['uri'] = substr(trim($item['uri'] ?? '') ?: self::newURI($item['guid']), 0, 255); // Store URI data $item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]); @@ -1853,13 +1853,12 @@ class Item /** * generate an unique URI * - * @param integer $uid User id - * @param string $guid An existing GUID (Otherwise it will be generated) + * @param string $guid An existing GUID (Otherwise it will be generated) * * @return string * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ - public static function newURI(int $uid, string $guid = ''): string + public static function newURI(string $guid = ''): string { if ($guid == '') { $guid = System::createUUID(); @@ -2150,7 +2149,7 @@ class Item $old_uri_id = $datarray["uri-id"] ?? 0; $datarray["guid"] = System::createUUID(); unset($datarray["plink"]); - $datarray["uri"] = self::newURI($contact['uid'], $datarray["guid"]); + $datarray["uri"] = self::newURI($datarray["guid"]); $datarray["uri-id"] = ItemURI::getIdByURI($datarray["uri"]); $datarray["extid"] = Protocol::DFRN; $urlpart = parse_url($datarray2['author-link']); @@ -2591,7 +2590,7 @@ class Item $new_item = [ 'guid' => System::createUUID(), - 'uri' => self::newURI($item['uid']), + 'uri' => self::newURI(), 'uid' => $item['uid'], 'contact-id' => $owner['id'], 'wall' => $item['wall'], diff --git a/src/Model/Mail.php b/src/Model/Mail.php index e42cb4ca43..afe3a3227a 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -154,7 +154,7 @@ class Mail Photo::setPermissionFromBody($body, local_user(), $me['id'], '<' . $contact['id'] . '>', '', '', ''); $guid = System::createUUID(); - $uri = Item::newURI(local_user(), $guid); + $uri = Item::newURI($guid); $convid = 0; $reply = false; @@ -266,7 +266,7 @@ class Mail } $guid = System::createUUID(); - $uri = Item::newURI(local_user(), $guid); + $uri = Item::newURI($guid); $me = Contact::getByURL($replyto); if (!$me['name']) { diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index 5392a98777..4a8c98697d 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -203,7 +203,7 @@ class Statuses extends BaseApi if (!empty($request['scheduled_at'])) { $item['guid'] = Item::guid($item, true); - $item['uri'] = Item::newURI($item['uid'], $item['guid']); + $item['uri'] = Item::newURI($item['guid']); $id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']); if (empty($id)) { DI::mstdnError()->InternalError(); diff --git a/src/Module/Contact/Poke.php b/src/Module/Contact/Poke.php index 0bbc40a980..5836c513f9 100644 --- a/src/Module/Contact/Poke.php +++ b/src/Module/Contact/Poke.php @@ -82,7 +82,7 @@ class Poke extends BaseModule $actor = Contact::getById($a->getContactId()); - $uri = Model\Item::newURI($uid); + $uri = Model\Item::newURI(); $arr = []; diff --git a/src/Protocol/ActivityPub/Transmitter.php b/src/Protocol/ActivityPub/Transmitter.php index 4c9bd3e214..a9c163964e 100644 --- a/src/Protocol/ActivityPub/Transmitter.php +++ b/src/Protocol/ActivityPub/Transmitter.php @@ -1271,7 +1271,7 @@ class Transmitter } if ($type == 'Delete') { - $data['id'] = Item::newURI($item['uid'], $item['guid']) . '/' . $type;; + $data['id'] = Item::newURI($item['guid']) . '/' . $type;; } elseif (($item['gravity'] == GRAVITY_ACTIVITY) && ($type != 'Undo')) { $data['id'] = $item['uri']; } else { diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index 65b0696eff..6601a2e8c3 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -618,7 +618,7 @@ class Feed // Additionally we have to avoid conflicts with identical URI between imported feeds and these items. if ($notify) { $item['guid'] = Item::guidFromUri($orig_plink, DI::baseUrl()->getHostname()); - $item['uri'] = Item::newURI($item['uid'], $item['guid']); + $item['uri'] = Item::newURI($item['guid']); unset($item['thr-parent']); unset($item['parent-uri']); -- 2.39.5