mirror of
https://github.com/friendica/friendica
synced 2025-04-29 14:24:22 +02:00
fix errors in all models
This commit is contained in:
parent
c61ae5da42
commit
92eff402af
6 changed files with 20 additions and 10 deletions
|
@ -128,7 +128,7 @@ class Engagement
|
|||
return ($ret && !$exists) ? $engagement['uri-id'] : 0;
|
||||
}
|
||||
|
||||
public static function getContentSize(array $item): int
|
||||
public static function getContentSize(array $item): int
|
||||
{
|
||||
$body = ' ' . $item['title'] . ' ' . $item['content-warning'] . ' ' . $item['body'];
|
||||
$body = BBCode::removeAttachment($body);
|
||||
|
@ -318,6 +318,8 @@ class Engagement
|
|||
$result = Post::selectPosts(['author-addr', 'author-nick', 'author-contact-type'],
|
||||
['thr-parent-id' => $uri_id, 'gravity' => Item::GRAVITY_ACTIVITY, 'verb' => Activity::ANNOUNCE, 'author-contact-type' => [Contact::TYPE_RELAY, Contact::TYPE_COMMUNITY]]);
|
||||
while ($reshare = Post::fetch($result)) {
|
||||
$prefix = '';
|
||||
|
||||
switch ($reshare['author-contact-type']) {
|
||||
case Contact::TYPE_RELAY:
|
||||
$prefix = ' application_';
|
||||
|
|
|
@ -113,9 +113,6 @@ class Link
|
|||
|
||||
try {
|
||||
$curlResult = HTTPSignature::fetchRaw($url, 0, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]);
|
||||
if (empty($curlResult) || !$curlResult->isSuccess()) {
|
||||
return [];
|
||||
}
|
||||
} catch (\Exception $exception) {
|
||||
Logger::notice('Error fetching url', ['url' => $url, 'exception' => $exception]);
|
||||
return [];
|
||||
|
|
|
@ -699,7 +699,7 @@ class Media
|
|||
if (preg_match_all("/\[url\](https?:.*?)\[\/url\]/ism", $body, $matches)) {
|
||||
foreach ($matches[1] as $url) {
|
||||
Logger::info('Got page url (link without description)', ['uri-id' => $uriid, 'url' => $url]);
|
||||
$result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false, $network);
|
||||
$result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false);
|
||||
if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::DIASPORA])) {
|
||||
self::revertHTMLType($uriid, $url, $fullbody);
|
||||
Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
|
||||
|
@ -715,7 +715,7 @@ class Media
|
|||
if (preg_match_all("/\[url\=(https?:.*?)\].*?\[\/url\]/ism", $body, $matches)) {
|
||||
foreach ($matches[1] as $url) {
|
||||
Logger::info('Got page url (link with description)', ['uri-id' => $uriid, 'url' => $url]);
|
||||
$result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false, $network);
|
||||
$result = self::insert(['uri-id' => $uriid, 'type' => self::UNKNOWN, 'url' => $url], false);
|
||||
if ($result && !in_array($network, [Protocol::ACTIVITYPUB, Protocol::DIASPORA])) {
|
||||
self::revertHTMLType($uriid, $url, $fullbody);
|
||||
Logger::debug('Revert HTML type', ['uri-id' => $uriid, 'url' => $url]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue