Merge pull request #10528 from annando/db-error
Avoid "DB Error" messages
This commit is contained in:
commit
e7880cd37d
|
@ -451,7 +451,7 @@ class BBCode
|
||||||
// Only send proxied pictures to API and for internal display
|
// Only send proxied pictures to API and for internal display
|
||||||
if (!in_array($simplehtml, [self::INTERNAL, self::API])) {
|
if (!in_array($simplehtml, [self::INTERNAL, self::API])) {
|
||||||
return $image;
|
return $image;
|
||||||
} elseif ($uriid) {
|
} elseif ($uriid > 0) {
|
||||||
return Post\Link::getByLink($uriid, $image, $size);
|
return Post\Link::getByLink($uriid, $image, $size);
|
||||||
} else {
|
} else {
|
||||||
return ProxyUtils::proxifyUrl($image, $size);
|
return ProxyUtils::proxifyUrl($image, $size);
|
||||||
|
|
|
@ -23,6 +23,7 @@ namespace Friendica\Model\Post;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Database\Database;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Util\Proxy;
|
use Friendica\Util\Proxy;
|
||||||
|
@ -52,7 +53,7 @@ class Link
|
||||||
} else {
|
} else {
|
||||||
$mime = self::fetchMimeType($url);
|
$mime = self::fetchMimeType($url);
|
||||||
|
|
||||||
DBA::insert('post-link', ['uri-id' => $uri_id, 'url' => $url, 'mimetype' => $mime]);
|
DBA::insert('post-link', ['uri-id' => $uri_id, 'url' => $url, 'mimetype' => $mime], Database::INSERT_IGNORE);
|
||||||
$id = DBA::lastInsertId();
|
$id = DBA::lastInsertId();
|
||||||
Logger::info('Inserted', ['id' => $id, 'uri-id' => $uri_id, 'url' => $url]);
|
Logger::info('Inserted', ['id' => $id, 'uri-id' => $uri_id, 'url' => $url]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,7 +297,7 @@ class UserNotification
|
||||||
$fields['target-uri-id'] = $item['uri-id'];
|
$fields['target-uri-id'] = $item['uri-id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return DBA::insert('notification', $fields);
|
return DBA::insert('notification', $fields, Database::INSERT_IGNORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,7 +318,7 @@ class UserNotification
|
||||||
'created' => DateTimeFormat::utcNow(),
|
'created' => DateTimeFormat::utcNow(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return DBA::insert('notification', $fields);
|
return DBA::insert('notification', $fields, Database::INSERT_IGNORE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue