Remove unused uid parameter in Item::newURI

This commit is contained in:
Hypolite Petovan 2022-07-09 07:32:32 -04:00
parent b31c2f4ec1
commit eb8237dd89
10 changed files with 17 additions and 18 deletions

View File

@ -525,7 +525,7 @@ function item_post(App $a) {
$origin = $_REQUEST['origin']; $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 // Fallback so that we alway have a parent uri
if (!$thr_parent_uri || !$toplevel_item_id) { if (!$thr_parent_uri || !$toplevel_item_id) {

View File

@ -360,7 +360,7 @@ function photos_post(App $a)
if (DBA::isResult($photos) && !$item_id) { if (DBA::isResult($photos) && !$item_id) {
// Create item container // Create item container
$title = ''; $title = '';
$uri = Item::newURI($page_owner_uid); $uri = Item::newURI();
$arr = []; $arr = [];
$arr['guid'] = System::createUUID(); $arr['guid'] = System::createUUID();
@ -524,7 +524,7 @@ function photos_post(App $a)
if (count($taginfo)) { if (count($taginfo)) {
foreach ($taginfo as $tagged) { foreach ($taginfo as $tagged) {
$uri = Item::newURI($page_owner_uid); $uri = Item::newURI();
$arr = []; $arr = [];
$arr['guid'] = System::createUUID(); $arr['guid'] = System::createUUID();
@ -728,7 +728,7 @@ function photos_post(App $a)
$smallest = 2; $smallest = 2;
} }
$uri = Item::newURI($page_owner_uid); $uri = Item::newURI();
// Create item container // Create item container
$lat = $lon = null; $lat = $lon = null;

View File

@ -73,7 +73,7 @@ function tagger_content(App $a) {
return; return;
} }
$uri = Item::newURI($owner_uid); $uri = Item::newURI();
$xterm = XML::escape($term); $xterm = XML::escape($term);
$post_type = (($item['resource-id']) ? DI::l10n()->t('photo') : DI::l10n()->t('status')); $post_type = (($item['resource-id']) ? DI::l10n()->t('photo') : DI::l10n()->t('status'));
$targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE ); $targettype = (($item['resource-id']) ? Activity\ObjectType::IMAGE : Activity\ObjectType::NOTE );

View File

@ -248,7 +248,7 @@ class Event
$event['uid'] = intval($arr['uid'] ?? 0); $event['uid'] = intval($arr['uid'] ?? 0);
$event['cid'] = intval($arr['cid'] ?? 0); $event['cid'] = intval($arr['cid'] ?? 0);
$event['guid'] = ($arr['guid'] ?? '') ?: System::createUUID(); $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['uri-id'] = ItemURI::insert(['uri' => $event['uri'], 'guid' => $event['guid']]);
$event['type'] = ($arr['type'] ?? '') ?: 'event'; $event['type'] = ($arr['type'] ?? '') ?: 'event';
$event['summary'] = $arr['summary'] ?? ''; $event['summary'] = $arr['summary'] ?? '';

View File

@ -780,7 +780,7 @@ class Item
$uid = intval($item['uid']); $uid = intval($item['uid']);
$item['guid'] = self::guid($item, $notify); $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 // Store URI data
$item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]); $item['uri-id'] = ItemURI::insert(['uri' => $item['uri'], 'guid' => $item['guid']]);
@ -1853,13 +1853,12 @@ class Item
/** /**
* generate an unique URI * 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 * @return string
* @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/ */
public static function newURI(int $uid, string $guid = ''): string public static function newURI(string $guid = ''): string
{ {
if ($guid == '') { if ($guid == '') {
$guid = System::createUUID(); $guid = System::createUUID();
@ -2150,7 +2149,7 @@ class Item
$old_uri_id = $datarray["uri-id"] ?? 0; $old_uri_id = $datarray["uri-id"] ?? 0;
$datarray["guid"] = System::createUUID(); $datarray["guid"] = System::createUUID();
unset($datarray["plink"]); 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["uri-id"] = ItemURI::getIdByURI($datarray["uri"]);
$datarray["extid"] = Protocol::DFRN; $datarray["extid"] = Protocol::DFRN;
$urlpart = parse_url($datarray2['author-link']); $urlpart = parse_url($datarray2['author-link']);
@ -2591,7 +2590,7 @@ class Item
$new_item = [ $new_item = [
'guid' => System::createUUID(), 'guid' => System::createUUID(),
'uri' => self::newURI($item['uid']), 'uri' => self::newURI(),
'uid' => $item['uid'], 'uid' => $item['uid'],
'contact-id' => $owner['id'], 'contact-id' => $owner['id'],
'wall' => $item['wall'], 'wall' => $item['wall'],

View File

@ -154,7 +154,7 @@ class Mail
Photo::setPermissionFromBody($body, local_user(), $me['id'], '<' . $contact['id'] . '>', '', '', ''); Photo::setPermissionFromBody($body, local_user(), $me['id'], '<' . $contact['id'] . '>', '', '', '');
$guid = System::createUUID(); $guid = System::createUUID();
$uri = Item::newURI(local_user(), $guid); $uri = Item::newURI($guid);
$convid = 0; $convid = 0;
$reply = false; $reply = false;
@ -266,7 +266,7 @@ class Mail
} }
$guid = System::createUUID(); $guid = System::createUUID();
$uri = Item::newURI(local_user(), $guid); $uri = Item::newURI($guid);
$me = Contact::getByURL($replyto); $me = Contact::getByURL($replyto);
if (!$me['name']) { if (!$me['name']) {

View File

@ -203,7 +203,7 @@ class Statuses extends BaseApi
if (!empty($request['scheduled_at'])) { if (!empty($request['scheduled_at'])) {
$item['guid'] = Item::guid($item, true); $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']); $id = Post\Delayed::add($item['uri'], $item, PRIORITY_HIGH, Post\Delayed::PREPARED, $request['scheduled_at']);
if (empty($id)) { if (empty($id)) {
DI::mstdnError()->InternalError(); DI::mstdnError()->InternalError();

View File

@ -82,7 +82,7 @@ class Poke extends BaseModule
$actor = Contact::getById($a->getContactId()); $actor = Contact::getById($a->getContactId());
$uri = Model\Item::newURI($uid); $uri = Model\Item::newURI();
$arr = []; $arr = [];

View File

@ -1271,7 +1271,7 @@ class Transmitter
} }
if ($type == 'Delete') { 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')) { } elseif (($item['gravity'] == GRAVITY_ACTIVITY) && ($type != 'Undo')) {
$data['id'] = $item['uri']; $data['id'] = $item['uri'];
} else { } else {

View File

@ -618,7 +618,7 @@ class Feed
// Additionally we have to avoid conflicts with identical URI between imported feeds and these items. // Additionally we have to avoid conflicts with identical URI between imported feeds and these items.
if ($notify) { if ($notify) {
$item['guid'] = Item::guidFromUri($orig_plink, DI::baseUrl()->getHostname()); $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['thr-parent']);
unset($item['parent-uri']); unset($item['parent-uri']);