X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FAPContact.php;h=baa364e940636a4e1d39ea7e40cadd5fed0e7bdb;hb=a2a7d04fa1f3073e1bf79703e9516b20e502c225;hp=9442db00cdfc79138d101f0bf53cdb1121c240f1;hpb=10bb7d562571bd2976e6e07fa821ed7e62d23ce2;p=friendica.git diff --git a/src/Model/APContact.php b/src/Model/APContact.php index 9442db00cd..baa364e940 100644 --- a/src/Model/APContact.php +++ b/src/Model/APContact.php @@ -116,6 +116,7 @@ class APContact * @return array profile array * @throws \Friendica\Network\HTTPException\InternalServerErrorException * @throws \ImagickException + * @todo Rewrite parameter $update to avoid true|false|null (boolean is binary, null adds a third case) */ public static function getByURL(string $url, $update = null): array { @@ -124,7 +125,7 @@ class APContact return []; } - $fetched_contact = false; + $fetched_contact = []; if (empty($update)) { if (is_null($update)) { @@ -164,6 +165,8 @@ class APContact return $fetched_contact; } $url = $apcontact['url']; + } elseif (empty(parse_url($url, PHP_URL_PATH))) { + $apcontact['baseurl'] = $url; } // Detect multiple fast repeating request to the same address @@ -206,7 +209,7 @@ class APContact if ($failed) { self::markForArchival($fetched_contact ?: []); - return $fetched_contact ?? []; + return $fetched_contact; } } @@ -465,7 +468,7 @@ class APContact } // Limit the length on incoming fields - $apcontact = DBStructure::getFieldsForTable('apcontact', $apcontact); + $apcontact = DI::dbaDefinition()->truncateFieldsForTable('apcontact', $apcontact); if (DBA::exists('apcontact', ['url' => $apcontact['url']])) { DBA::update('apcontact', $apcontact, ['url' => $apcontact['url']]); @@ -526,6 +529,7 @@ class APContact * * @param string $url inbox url * @param boolean $shared Shared Inbox + * @return void */ private static function unarchiveInbox(string $url, bool $shared) {