Merge pull request #8911 from MrPetovan/task/curl_DI

Introduce "HTTPRequest" class
This commit is contained in:
Michael Vogel 2020-07-25 09:50:20 +02:00 committed by GitHub
commit 398e65d66b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 765 additions and 647 deletions

View file

@ -3682,7 +3682,7 @@ class Item
*
* @return integer item id
*/
public static function fetchByLink($uri, $uid = 0)
public static function fetchByLink(string $uri, int $uid = 0)
{
$item_id = self::searchByLink($uri, $uid);
if (!empty($item_id)) {
@ -3735,7 +3735,7 @@ class Item
*
* @return array item array with data from the original item
*/
public static function addShareDataFromOriginal($item)
public static function addShareDataFromOriginal(array $item)
{
$shared = self::getShareArray($item);
if (empty($shared)) {
@ -3757,9 +3757,9 @@ class Item
}
// Otherwhise try to find (and possibly fetch) the item via the link. This should work for Diaspora and ActivityPub posts
$id = self::fetchByLink($shared['link'], $uid);
$id = self::fetchByLink($shared['link'] ?? '', $uid);
if (empty($id)) {
Logger::info('Original item not found', ['url' => $shared['link'], 'callstack' => System::callstack()]);
Logger::info('Original item not found', ['url' => $shared['link'] ?? '', 'callstack' => System::callstack()]);
return $item;
}