mirror of
https://github.com/friendica/friendica
synced 2025-04-27 02:30:10 +00:00
Performance: Avoid queries where there is no media or category
This commit is contained in:
parent
69984ac6bc
commit
4daae255d8
6 changed files with 28 additions and 6 deletions
|
@ -547,12 +547,17 @@ class Media
|
|||
* @param int $uri_id
|
||||
* @param string $guid
|
||||
* @param array $links list of links that shouldn't be added
|
||||
* @param bool $has_media
|
||||
* @return array attachments
|
||||
*/
|
||||
public static function splitAttachments(int $uri_id, string $guid = '', array $links = [])
|
||||
public static function splitAttachments(int $uri_id, string $guid = '', array $links = [], bool $has_media = true)
|
||||
{
|
||||
$attachments = ['visual' => [], 'link' => [], 'additional' => []];
|
||||
|
||||
if (!$has_media) {
|
||||
return $attachments;
|
||||
}
|
||||
|
||||
$media = self::getByURIId($uri_id);
|
||||
if (empty($media)) {
|
||||
return $attachments;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue