1
0
Fork 0

Merge pull request #11720 from MrPetovan/bug/fatal-errors

Remove unused uid parameter in Item::newURI
This commit is contained in:
Michael Vogel 2022-07-09 13:52:57 +02:00 committed by GitHub
commit d87963d8a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 18 deletions

View file

@ -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) {

View file

@ -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;

View file

@ -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 );

View file

@ -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'] ?? '';

View file

@ -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'],

View file

@ -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']) {

View file

@ -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();

View file

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

View file

@ -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 {

View file

@ -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']);