use Friendica\Model\Conversation;
use Friendica\Model\Item;
use Friendica\Model\ItemURI;
+use Friendica\Model\Post;
use Friendica\Model\Tag;
use Friendica\Model\User;
use Friendica\Network\Probe;
}
// Ensure that we are having this contact (with uid=0)
- $cid = Contact::getIdForURL($aliaslink, 0, false);
+ $cid = Contact::getIdForURL($aliaslink);
if ($cid) {
$fields = ['url', 'nurl', 'name', 'nick', 'alias', 'about', 'location'];
} elseif ($item['contact-id'] < 0) {
Logger::log("Item with uri ".$item["uri"]." is from a blocked contact.", Logger::DEBUG);
} else {
- // We are having duplicated entries. Hopefully this solves it.
- if (DI::lock()->acquire('ostatus_process_item_insert')) {
- $ret = Item::insert($item);
- DI::lock()->release('ostatus_process_item_insert');
- Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
- } else {
- $ret = Item::insert($item);
- Logger::log("We couldn't lock - but tried to store the item anyway. Return value is ".$ret);
- }
+ $ret = Item::insert($item);
+ Logger::log("Item with uri ".$item["uri"]." for user ".$importer["uid"].' stored. Return value: '.$ret);
}
}
}
self::$conv_list[$conversation] = true;
- $curlResult = DI::httpRequest()->get($conversation, false, ['accept_content' => 'application/atom+xml, text/html']);
+ $curlResult = DI::httpRequest()->get($conversation, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
}
$stored = false;
- $curlResult = DI::httpRequest()->get($related, false, ['accept_content' => 'application/atom+xml, text/html']);
+ $curlResult = DI::httpRequest()->get($related, ['accept_content' => 'application/atom+xml, text/html']);
if (!$curlResult->isSuccess()) {
return;
if (!isset($attribute['length'])) {
$attribute['length'] = "0";
}
- $item["attach"] .= '[attach]href="'.$attribute['href'].'" length="'.$attribute['length'].'" type="'.$attribute['type'].'" title="'.($attribute['title'] ?? '') .'"[/attach]';
+ $item["attach"] .= Post\Media::getAttachElement($attribute['href'],
+ $attribute['length'], $attribute['type'], $attribute['title'] ?? '');
}
break;
case "related":
}
$check_date = DateTimeFormat::utc($last_update);
- $authorid = Contact::getIdForURL($owner["url"], 0, false);
+ $authorid = Contact::getIdForURL($owner["url"]);
$condition = ["`uid` = ? AND `received` > ? AND NOT `deleted`
AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?)",
* Checks if the given contact url does support OStatus
*
* @param string $url profile url
- * @param boolean $update Update the profile
* @return boolean
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \ImagickException
*/
- public static function isSupportedByContactUrl($url, $update = false)
+ public static function isSupportedByContactUrl($url)
{
- $probe = Probe::uri($url, Protocol::OSTATUS, 0, !$update);
+ $probe = Probe::uri($url, Protocol::OSTATUS);
return $probe['network'] == Protocol::OSTATUS;
}
}