diff --git a/src/Model/Mail.php b/src/Model/Mail.php index 372ec8a452..08c703cecc 100644 --- a/src/Model/Mail.php +++ b/src/Model/Mail.php @@ -127,8 +127,6 @@ class Mail */ public static function send(int $sender_uid, int $recipient = 0, string $body = '', string $subject = '', string $replyto = ''): int { - $a = DI::app(); - if (!$recipient) { return -1; } @@ -246,77 +244,4 @@ class Mail return -3; } } - - /** - * @param array $recipient recipient, default empty - * @param string $body message body, default empty - * @param string $subject message subject, default empty - * @param string $replyto reply to, default empty - * @return int - * @throws \Friendica\Network\HTTPException\InternalServerErrorException - * @throws \ImagickException - */ - public static function sendWall(array $recipient = [], string $body = '', string $subject = '', string $replyto = ''): int - { - if (!$recipient) { - return -1; - } - - if (!strlen($subject)) { - $subject = DI::l10n()->t('[no subject]'); - } - - $guid = System::createUUID(); - $uri = Item::newURI($guid); - - $me = Contact::getByURL($replyto); - if (!$me['name']) { - return -2; - } - - $conv_guid = System::createUUID(); - - $recip_handle = $recipient['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3); - - $sender_handle = $me['addr']; - - $handles = $recip_handle . ';' . $sender_handle; - - $convid = null; - $fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle, - 'created' => DateTimeFormat::utcNow(), 'updated' => DateTimeFormat::utcNow(), - 'subject' => $subject, 'recips' => $handles]; - if (DBA::insert('conv', $fields)) { - $convid = DBA::lastInsertId(); - } - - if (!$convid) { - Logger::warning('conversation not found.'); - return -4; - } - - self::insert( - [ - 'uid' => $recipient['uid'], - 'guid' => $guid, - 'convid' => $convid, - 'from-name' => $me['name'], - 'from-photo' => $me['photo'], - 'from-url' => $me['url'], - 'contact-id' => 0, - 'title' => $subject, - 'body' => $body, - 'seen' => 0, - 'reply' => 0, - 'replied' => 0, - 'uri' => $uri, - 'parent-uri' => $me['url'], - 'created' => DateTimeFormat::utcNow(), - 'unknown' => 1 - ], - false - ); - - return 0; - } } diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 6e5773d363..4700db6f50 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -762,9 +762,10 @@ class Photo )); } else { // This query doesn't do the count and is much faster - $albums = DBA::toArray(DBA::p("SELECT DISTINCT(`album`), '' AS `total` + $albums = DBA::toArray(DBA::p("SELECT '' AS `total`, `album`, MIN(`created`) AS `created` FROM `photo` USE INDEX (`uid_album_scale_created`) - WHERE `uid` = ? AND `photo-type` IN (?, ?, ?) $sql_extra", + WHERE `uid` = ? AND `photo-type` IN (?, ?, ?) $sql_extra + GROUP BY `album` ORDER BY `created` DESC", $uid, self::DEFAULT, $banner_type,