Compare commits

...

10 commits

Author SHA1 Message Date
Hypolite Petovan
f56054ecc1
Merge pull request #13561 from annando/log-callstack
Individual callstacks are removed from the logger
2023-10-18 16:02:08 -04:00
Michael
e4a37f344e Individual callstacks are removed from the logger 2023-10-18 19:55:15 +00:00
Hypolite Petovan
d05fbe6e45
Merge pull request #13558 from foss-/patch-8
Update README.md: rewrote intro text
2023-10-18 11:51:27 -04:00
foss-
03839fc0fe
Update README.md
moved "Being part of..." further down
2023-10-18 17:50:19 +02:00
foss-
a20cdbd5c7
Update README.md
typos and minor tweaks

Co-authored-by: Hypolite Petovan <hypolite@mrpetovan.com>
2023-10-18 17:37:50 +02:00
Hypolite Petovan
3dd34619ec
Merge pull request #13557 from annando/api-timeline
Improve the performance of API timeline calls
2023-10-18 10:33:58 -04:00
Hypolite Petovan
df791c7e54
Merge pull request #13555 from foss-/patch-9
Update README.md: humane tech has a new home on codeberg
2023-10-18 10:31:03 -04:00
foss-
1cd4f705fd
Update README.md: rewrote intro text
removed twitter,  mentioning other fediverse platforms sorted by popularity, reduced number of paragraphs and simplified text overall.
2023-10-18 10:54:01 +02:00
Michael
1c67be8db0 Improve the performance of API timeline calls 2023-10-18 08:11:36 +00:00
foss-
eee0a32d03
Update README.md: humane tech has a new home on codeberg
reflect new home of humane tech by updating links to codeberg
2023-10-18 09:18:16 +02:00
44 changed files with 221 additions and 126 deletions

View file

@ -1,21 +1,15 @@
Friendica Social Communications Server Friendica - your open and free social network
====================================== =============================================
Welcome to the free social web. Welcome to the free social web. Friendica is a platform for decentralised social communication linking to other independent social and corporate services.
Friendica is a decentralised communications platform that integrates social communication. Our platform links to independent social projects and corporate services. Friendica connects you to a federated communications network of thousands of servers called the Fediverse. Through various protocols you can interact with anyone on [Friendica]( https://friendi.ca), [Mastodon](https://joinmastodon.org), [Lemmy](https://join-lemmy.org/), [Diaspora](https://diasporafoundation.org), [Misskey](https://join.misskey.page), [Peertube](https://joinpeertube.org/), [Pixelfed](https://pixelfed.org/), [Pleroma](https://pleroma.social) and many more. Receiving content from Tumblr, Wordpress and RSS is also possible. Friendica allows to import and mirror your content via add-ons such as ITTT and Buffer. You can customize and control how publicly or privately you want to share your content.
Our mission is to free friends, family and colleagues from data-harvesting corporations; we aim for social communication to be free and open, while flowing between any provider as easily as email does. Being part of the Fediverse allows you to be free from data-harvesting corporations. Enjoy open social communication, independent of any specific provider.
Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on [Friendica]( https://friendi.ca), [Mastodon](https://joinmastodon.org/), [Diaspora](https://diasporafoundation.org/), [GnuSocial](https://gnu.io/social/), [Pleroma](https://pleroma.social/), or [Hubzilla](https://hubzilla.org/), regardless where each user profile is hosted. [Join Friendica]((https://dir.friendica.social/servers)) today or setup [your own Friendica instance](doc/Install.md).
With Friendica, you can also fully interact with anyone on Twitter and receive any content from Tumblr, Wordpress or RSS. Friendica allows you to integrate most things on the web via a range of addons such as ITTT, Buffer; you will be able to easily control your own data as you decide. ### Screenshots
Join today and [get your Friendica profile!](https://dir.friendica.social/servers 'Join Friendica today!')
Have a look at the [installation documentation](doc/Install.md) for further information about installing and using Friendica.
### Friendica Screenshots
| ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-1.png?raw=true "Frio theme in mobile browser") ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-2.png?raw=true "Frio theme in mobile browser") | | ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-1.png?raw=true "Frio theme in mobile browser") ![Frio theme in mobile browser](images/screenshots/friendica-frio-mobile-profile-2.png?raw=true "Frio theme in mobile browser") |
|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| |:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
@ -43,4 +37,4 @@ Have a look at the [installation documentation](doc/Install.md) for further info
## Endorsements ## Endorsements
- [![Awesome Humane Tech](images/humane-tech-badge.svg)](https://github.com/humanetech-community/awesome-humane-tech) On August 12th 2020, Friendica was added to [the curated Awesome Humane Tech directory](https://github.com/humanetech-community/awesome-humane-tech) in [the "Fediverse" category](https://github.com/humanetech-community/awesome-humane-tech#fediverse). - [![Awesome Humane Tech](images/humane-tech-badge.svg)](https://codeberg.org/teaserbot-labs/delightful-humane-design) In August 2020 Friendica was added to the curated delightful humane design resources in the [Fediverse category](https://codeberg.org/teaserbot-labs/delightful-humane-design#fediverse).

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 2023.09-rc (Giant Rhubarb) -- Friendica 2023.09-rc (Giant Rhubarb)
-- DB_UPDATE_VERSION 1537 -- DB_UPDATE_VERSION 1538
-- ------------------------------------------ -- ------------------------------------------
@ -1991,6 +1991,51 @@ CREATE VIEW `circle-member-view` AS SELECT
INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id` INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`; INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`;
--
-- VIEW post-timeline-view
--
DROP VIEW IF EXISTS `post-timeline-view`;
CREATE VIEW `post-timeline-view` AS SELECT
`post-user`.`uid` AS `uid`,
`post-user`.`uri-id` AS `uri-id`,
`post-user`.`gravity` AS `gravity`,
`post-user`.`created` AS `created`,
`post-user`.`edited` AS `edited`,
`post-thread-user`.`commented` AS `commented`,
`post-user`.`received` AS `received`,
`post-thread-user`.`changed` AS `changed`,
`post-user`.`private` AS `private`,
`post-user`.`visible` AS `visible`,
`post-user`.`deleted` AS `deleted`,
`post-user`.`origin` AS `origin`,
`post-user`.`global` AS `global`,
`post-user`.`network` AS `network`,
`post-user`.`protocol` AS `protocol`,
`post-user`.`vid` AS `vid`,
`post-user`.`contact-id` AS `contact-id`,
`contact`.`blocked` AS `contact-blocked`,
`contact`.`readonly` AS `contact-readonly`,
`contact`.`pending` AS `contact-pending`,
`contact`.`rel` AS `contact-rel`,
`contact`.`uid` AS `contact-uid`,
`contact`.`self` AS `self`,
`post-user`.`author-id` AS `author-id`,
`author`.`blocked` AS `author-blocked`,
`author`.`hidden` AS `author-hidden`,
`author`.`gsid` AS `author-gsid`,
`post-user`.`owner-id` AS `owner-id`,
`owner`.`blocked` AS `owner-blocked`,
`owner`.`gsid` AS `owner-gsid`,
`post-user`.`causer-id` AS `causer-id`,
`causer`.`blocked` AS `causer-blocked`,
`causer`.`gsid` AS `causer-gsid`
FROM `post-user`
LEFT JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`;
-- --
-- VIEW post-user-view -- VIEW post-user-view
-- --

View file

@ -33,7 +33,6 @@ use Friendica\Module\Response;
use Friendica\Module\Special\HTTPException as ModuleHTTPException; use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\Profiler; use Friendica\Util\Profiler;
use Friendica\Util\XML;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
@ -494,7 +493,7 @@ abstract class BaseModule implements ICanHandleRequests
public function httpError(int $httpCode, string $message = '', $content = '') public function httpError(int $httpCode, string $message = '', $content = '')
{ {
if ($httpCode >= 400) { if ($httpCode >= 400) {
$this->logger->debug('Exit with error', ['code' => $httpCode, 'message' => $message, 'callstack' => System::callstack(20), 'method' => $this->args->getMethod(), 'agent' => $this->server['HTTP_USER_AGENT'] ?? '']); $this->logger->debug('Exit with error', ['code' => $httpCode, 'message' => $message, 'method' => $this->args->getMethod(), 'agent' => $this->server['HTTP_USER_AGENT'] ?? '']);
} }
$this->response->setStatus($httpCode, $message); $this->response->setStatus($httpCode, $message);
@ -529,7 +528,7 @@ abstract class BaseModule implements ICanHandleRequests
public function jsonError(int $httpCode, $content, string $content_type = 'application/json') public function jsonError(int $httpCode, $content, string $content_type = 'application/json')
{ {
if ($httpCode >= 400) { if ($httpCode >= 400) {
$this->logger->debug('Exit with error', ['code' => $httpCode, 'content_type' => $content_type, 'callstack' => System::callstack(20), 'method' => $this->args->getMethod(), 'agent' => $this->server['HTTP_USER_AGENT'] ?? '']); $this->logger->debug('Exit with error', ['code' => $httpCode, 'content_type' => $content_type, 'method' => $this->args->getMethod(), 'agent' => $this->server['HTTP_USER_AGENT'] ?? '']);
} }
$this->response->setStatus($httpCode); $this->response->setStatus($httpCode);

View file

@ -22,7 +22,6 @@
namespace Friendica\Content\Text; namespace Friendica\Content\Text;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -112,7 +111,7 @@ class Markdown
{ {
// @TODO Temporary until we find the source of the null value to finally set the correct type-hint // @TODO Temporary until we find the source of the null value to finally set the correct type-hint
if (is_null($s)) { if (is_null($s)) {
Logger::warning('Received null value', ['callstack' => System::callstack()]); Logger::warning('Received null value');
return ''; return '';
} }

View file

@ -26,7 +26,6 @@ use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
use Friendica\Util\Network; use Friendica\Util\Network;
@ -48,7 +47,7 @@ class VCard
public static function getHTML(array $contact): string public static function getHTML(array $contact): string
{ {
if (!isset($contact['network']) || !isset($contact['id'])) { if (!isset($contact['network']) || !isset($contact['id'])) {
Logger::warning('Incomplete contact', ['contact' => $contact ?? [], 'callstack' => System::callstack(20)]); Logger::warning('Incomplete contact', ['contact' => $contact ?? []]);
} }
if (!Network::isValidHttpUrl($contact['url']) && Network::isValidHttpUrl($contact['alias'])) { if (!Network::isValidHttpUrl($contact['url']) && Network::isValidHttpUrl($contact['alias'])) {

View file

@ -87,7 +87,7 @@ class Introspection implements IHaveCallIntrospections
'line' => $trace[$i - 1]['line'] ?? null, 'line' => $trace[$i - 1]['line'] ?? null,
'function' => $trace[$i]['function'] ?? null, 'function' => $trace[$i]['function'] ?? null,
'request-id' => $this->requestId, 'request-id' => $this->requestId,
'stack' => System::callstack(10, 0, true, ['Friendica\Core\Logger\Type\StreamLogger', 'Friendica\Core\Logger\Type\AbstractLogger', 'Friendica\Core\Logger\Type\WorkerLogger', 'Friendica\Core\Logger']), 'stack' => System::callstack(15, 0, true, ['Friendica\Core\Logger\Type\StreamLogger', 'Friendica\Core\Logger\Type\AbstractLogger', 'Friendica\Core\Logger\Type\WorkerLogger', 'Friendica\Core\Logger']),
]; ];
} }

View file

@ -220,7 +220,7 @@ class System
proc_close($resource); proc_close($resource);
$this->logger->info('Executed "proc_open"', ['command' => $cmdline, 'callstack' => System::callstack(10)]); $this->logger->info('Executed "proc_open"', ['command' => $cmdline]);
} }
/** /**
@ -348,7 +348,7 @@ class System
public static function httpError($httpCode, $message = '', $content = '') public static function httpError($httpCode, $message = '', $content = '')
{ {
if ($httpCode >= 400) { if ($httpCode >= 400) {
Logger::debug('Exit with error', ['code' => $httpCode, 'message' => $message, 'callstack' => System::callstack(20), 'method' => DI::args()->getMethod(), 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); Logger::debug('Exit with error', ['code' => $httpCode, 'message' => $message, 'method' => DI::args()->getMethod(), 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
} }
DI::apiResponse()->setStatus($httpCode, $message); DI::apiResponse()->setStatus($httpCode, $message);
@ -381,7 +381,7 @@ class System
public static function jsonError($httpCode, $content, $content_type = 'application/json') public static function jsonError($httpCode, $content, $content_type = 'application/json')
{ {
if ($httpCode >= 400) { if ($httpCode >= 400) {
Logger::debug('Exit with error', ['code' => $httpCode, 'content_type' => $content_type, 'callstack' => System::callstack(20), 'method' => DI::args()->getMethod(), 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']); Logger::debug('Exit with error', ['code' => $httpCode, 'content_type' => $content_type, 'method' => DI::args()->getMethod(), 'agent' => $_SERVER['HTTP_USER_AGENT'] ?? '']);
} }
DI::apiResponse()->setStatus($httpCode); DI::apiResponse()->setStatus($httpCode);
self::jsonExit($content, $content_type); self::jsonExit($content, $content_type);

View file

@ -1276,7 +1276,7 @@ class Worker
$added = 0; $added = 0;
if (!is_int($priority) || !in_array($priority, self::PRIORITIES)) { if (!is_int($priority) || !in_array($priority, self::PRIORITIES)) {
Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command, 'callstack' => System::callstack(20)]); Logger::warning('Invalid priority', ['priority' => $priority, 'command' => $command]);
$priority = self::PRIORITY_MEDIUM; $priority = self::PRIORITY_MEDIUM;
} }

View file

@ -528,7 +528,7 @@ class Database
if ((substr_count($sql, '?') != count($args)) && (count($args) > 0)) { if ((substr_count($sql, '?') != count($args)) && (count($args) > 0)) {
// Question: Should we continue or stop the query here? // Question: Should we continue or stop the query here?
$this->logger->warning('Query parameters mismatch.', ['query' => $sql, 'args' => $args, 'callstack' => System::callstack()]); $this->logger->warning('Query parameters mismatch.', ['query' => $sql, 'args' => $args]);
} }
$sql = DBA::cleanQuery($sql); $sql = DBA::cleanQuery($sql);
@ -702,7 +702,6 @@ class Database
$this->logger->error('DB Error', [ $this->logger->error('DB Error', [
'code' => $errorno, 'code' => $errorno,
'error' => $error, 'error' => $error,
'callstack' => System::callstack(8),
'params' => $this->replaceParameters($sql, $args), 'params' => $this->replaceParameters($sql, $args),
]); ]);
@ -810,7 +809,6 @@ class Database
$this->logger->error('DB Error', [ $this->logger->error('DB Error', [
'code' => $errorno, 'code' => $errorno,
'error' => $error, 'error' => $error,
'callstack' => System::callstack(8),
'params' => $this->replaceParameters($sql, $params), 'params' => $this->replaceParameters($sql, $params),
]); ]);
@ -1292,7 +1290,7 @@ class Database
$condition_string = DBA::buildCondition($conditions); $condition_string = DBA::buildCondition($conditions);
$sql = "DELETE FROM " . $table_string . " " . $condition_string; $sql = "DELETE FROM " . $table_string . " " . $condition_string;
$this->logger->debug($this->replaceParameters($sql, $conditions), ['callstack' => System::callstack(6)]); $this->logger->debug($this->replaceParameters($sql, $conditions));
return $this->e($sql, $conditions); return $this->e($sql, $conditions);
} }

View file

@ -176,7 +176,7 @@ class APContact
$cachekey = 'apcontact:' . ItemURI::getIdByURI($url); $cachekey = 'apcontact:' . ItemURI::getIdByURI($url);
$result = DI::cache()->get($cachekey); $result = DI::cache()->get($cachekey);
if (!is_null($result)) { if (!is_null($result)) {
Logger::info('Multiple requests for the address', ['url' => $url, 'update' => $update, 'callstack' => System::callstack(20), 'result' => $result]); Logger::info('Multiple requests for the address', ['url' => $url, 'update' => $update, 'result' => $result]);
if (!empty($fetched_contact)) { if (!empty($fetched_contact)) {
return $fetched_contact; return $fetched_contact;
} }

View file

@ -1081,7 +1081,7 @@ class Contact
return; return;
} }
} elseif (!isset($contact['url'])) { } elseif (!isset($contact['url'])) {
Logger::info('Empty contact', ['contact' => $contact, 'callstack' => System::callstack(20)]); Logger::info('Empty contact', ['contact' => $contact]);
} }
Logger::info('Contact is marked for archival', ['id' => $contact['id'], 'term-date' => $contact['term-date']]); Logger::info('Contact is marked for archival', ['id' => $contact['id'], 'term-date' => $contact['term-date']]);
@ -1366,7 +1366,7 @@ class Contact
} }
if (DBA::isResult($personal_contact)) { if (DBA::isResult($personal_contact)) {
Logger::info('Take contact data from personal contact', ['url' => $url, 'update' => $update, 'contact' => $personal_contact, 'callstack' => System::callstack(20)]); Logger::info('Take contact data from personal contact', ['url' => $url, 'update' => $update, 'contact' => $personal_contact]);
$data = $personal_contact; $data = $personal_contact;
$data['photo'] = $personal_contact['avatar']; $data['photo'] = $personal_contact['avatar'];
$data['account-type'] = $personal_contact['contact-type']; $data['account-type'] = $personal_contact['contact-type'];
@ -1378,7 +1378,7 @@ class Contact
} }
if (empty($data['network']) || ($data['network'] == Protocol::PHANTOM)) { if (empty($data['network']) || ($data['network'] == Protocol::PHANTOM)) {
Logger::notice('No valid network found', ['url' => $url, 'uid' => $uid, 'default' => $default, 'update' => $update, 'callstack' => System::callstack(20)]); Logger::notice('No valid network found', ['url' => $url, 'uid' => $uid, 'default' => $default, 'update' => $update]);
return 0; return 0;
} }
@ -2576,7 +2576,7 @@ class Contact
Worker::add(Worker::PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid); Worker::add(Worker::PRIORITY_HIGH, 'MergeContact', $first, $duplicate['id'], $uid);
} }
DBA::close($duplicates); DBA::close($duplicates);
Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl, 'callstack' => System::callstack(20)]); Logger::info('Duplicates handled', ['uid' => $uid, 'nurl' => $nurl]);
return true; return true;
} }
@ -2599,7 +2599,7 @@ class Contact
$stamp = (float)microtime(true); $stamp = (float)microtime(true);
self::updateFromProbe($id); self::updateFromProbe($id);
Logger::debug('Contact data is updated.', ['duration' => round((float)microtime(true) - $stamp, 3), 'id' => $id, 'url' => $contact['url'], 'callstack' => System::callstack(20)]); Logger::debug('Contact data is updated.', ['duration' => round((float)microtime(true) - $stamp, 3), 'id' => $id, 'url' => $contact['url']]);
return true; return true;
} }
@ -2839,7 +2839,7 @@ class Contact
} }
$ret['last-item'] = Probe::getLastUpdate($ret); $ret['last-item'] = Probe::getLastUpdate($ret);
Logger::info('Fetched last item', ['id' => $id, 'probed_url' => $ret['url'], 'last-item' => $ret['last-item'], 'callstack' => System::callstack(20)]); Logger::info('Fetched last item', ['id' => $id, 'probed_url' => $ret['url'], 'last-item' => $ret['last-item']]);
} }
$update = false; $update = false;
@ -3370,7 +3370,7 @@ class Contact
} elseif (!empty($contact['id'])) { } elseif (!empty($contact['id'])) {
self::remove($contact['id']); self::remove($contact['id']);
} else { } else {
DI::logger()->info('Couldn\'t remove follower because of invalid contact array', ['contact' => $contact, 'callstack' => System::callstack()]); DI::logger()->info('Couldn\'t remove follower because of invalid contact array', ['contact' => $contact]);
return; return;
} }

View file

@ -24,7 +24,6 @@ namespace Friendica\Model\Contact;
use Exception; use Exception;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -55,7 +54,7 @@ class User
} }
if (empty($contact['uri-id']) && empty($contact['url'])) { if (empty($contact['uri-id']) && empty($contact['url'])) {
Logger::info('Missing contact details', ['contact' => $contact, 'callstack' => System::callstack(20)]); Logger::info('Missing contact details', ['contact' => $contact]);
return false; return false;
} }

View file

@ -26,7 +26,6 @@ use DOMXPath;
use Exception; use Exception;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -126,7 +125,7 @@ class GServer
$gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]); $gserver = DBA::selectFirst('gserver', ['id'], ['nurl' => Strings::normaliseLink($url)]);
if (DBA::isResult($gserver)) { if (DBA::isResult($gserver)) {
Logger::debug('Got ID for URL', ['id' => $gserver['id'], 'url' => $url, 'callstack' => System::callstack(20)]); Logger::debug('Got ID for URL', ['id' => $gserver['id'], 'url' => $url]);
if (Network::isUrlBlocked($url)) { if (Network::isUrlBlocked($url)) {
self::setBlockedById($gserver['id']); self::setBlockedById($gserver['id']);
@ -2515,7 +2514,7 @@ class GServer
} }
} }
Logger::info('Protocol for server', ['protocol' => $protocol, 'old' => $old, 'id' => $gsid, 'url' => $gserver['url'], 'callstack' => System::callstack(20)]); Logger::info('Protocol for server', ['protocol' => $protocol, 'old' => $old, 'id' => $gsid, 'url' => $gserver['url']]);
self::update(['protocol' => $protocol], ['id' => $gsid]); self::update(['protocol' => $protocol], ['id' => $gsid]);
} }

View file

@ -330,7 +330,7 @@ class Item
*/ */
public static function markForDeletionById(int $item_id, int $priority = Worker::PRIORITY_HIGH): bool public static function markForDeletionById(int $item_id, int $priority = Worker::PRIORITY_HIGH): bool
{ {
Logger::info('Mark item for deletion by id', ['id' => $item_id, 'callstack' => System::callstack()]); Logger::info('Mark item for deletion by id', ['id' => $item_id]);
// locate item to be deleted // locate item to be deleted
$fields = [ $fields = [
'id', 'uri', 'uri-id', 'uid', 'parent', 'parent-uri-id', 'origin', 'id', 'uri', 'uri-id', 'uid', 'parent', 'parent-uri-id', 'origin',
@ -795,7 +795,7 @@ class Item
} }
if (!DBA::isResult($parent)) { if (!DBA::isResult($parent)) {
Logger::notice('item parent was not found - ignoring item', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid'], 'callstack' => System::callstack(20)]); Logger::notice('item parent was not found - ignoring item', ['uri-id' => $item['uri-id'], 'thr-parent-id' => $item['thr-parent-id'], 'uid' => $item['uid']]);
return []; return [];
} }
@ -1183,7 +1183,7 @@ class Item
if (!empty($quote_id)) { if (!empty($quote_id)) {
// This is one of these "should not happen" situations. // This is one of these "should not happen" situations.
// The protocol implementations should already have done this job. // The protocol implementations should already have done this job.
Logger::notice('Quote-uri-id detected in post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id'], 'callstack' => System::callstack(20)]); Logger::notice('Quote-uri-id detected in post', ['id' => $quote_id, 'guid' => $item['guid'], 'uri-id' => $item['uri-id']]);
$item['quote-uri-id'] = $quote_id; $item['quote-uri-id'] = $quote_id;
} }
} }
@ -2162,7 +2162,7 @@ class Item
$hostPart = $host ?: $parsed['host'] ?? ''; $hostPart = $host ?: $parsed['host'] ?? '';
if (!$hostPart) { if (!$hostPart) {
Logger::warning('Empty host GUID part', ['uri' => $uri, 'host' => $host, 'parsed' => $parsed, 'callstack' => System::callstack(10)]); Logger::warning('Empty host GUID part', ['uri' => $uri, 'host' => $host, 'parsed' => $parsed]);
} }
// Glue it together to be able to make a hash from it // Glue it together to be able to make a hash from it

View file

@ -589,7 +589,7 @@ class Photo
$photo_failure = false; $photo_failure = false;
if (!Network::isValidHttpUrl($image_url)) { if (!Network::isValidHttpUrl($image_url)) {
Logger::warning('Invalid image url', ['image_url' => $image_url, 'uid' => $uid, 'cid' => $cid, 'callstack' => System::callstack(20)]); Logger::warning('Invalid image url', ['image_url' => $image_url, 'uid' => $uid, 'cid' => $cid]);
return false; return false;
} }

View file

@ -23,7 +23,6 @@ namespace Friendica\Model;
use BadMethodCallException; use BadMethodCallException;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -497,6 +496,23 @@ class Post
return self::selectViewForUser('post-view', $uid, $selected, $condition, $params); return self::selectViewForUser('post-view', $uid, $selected, $condition, $params);
} }
/**
* Select rows from the post-timeline-view view for a given user
* This function is used for API calls.
*
* @param integer $uid User ID
* @param array $selected Array of selected fields, empty for all
* @param array $condition Array of fields for condition
* @param array $params Array of several parameters
*
* @return boolean|object
* @throws \Exception
*/
public static function selectTimelineForUser(int $uid, array $selected = [], array $condition = [], array $params = [])
{
return self::selectViewForUser('post-timeline-view', $uid, $selected, $condition, $params);
}
/** /**
* Select rows from the post-thread-user-view view for a given user * Select rows from the post-thread-user-view view for a given user
* *
@ -594,7 +610,7 @@ class Post
{ {
$affected = 0; $affected = 0;
Logger::info('Start Update', ['fields' => $fields, 'condition' => $condition, 'uid' => DI::userSession()->getLocalUserId(),'callstack' => System::callstack(10)]); Logger::info('Start Update', ['fields' => $fields, 'condition' => $condition, 'uid' => DI::userSession()->getLocalUserId()]);
// Don't allow changes to fields that are responsible for the relation between the records // Don't allow changes to fields that are responsible for the relation between the records
unset($fields['id']); unset($fields['id']);

View file

@ -22,7 +22,6 @@
namespace Friendica\Model\Post; namespace Friendica\Model\Post;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -67,7 +66,7 @@ class Link
} }
if (!in_array(parse_url($url, PHP_URL_SCHEME), ['http', 'https'])) { if (!in_array(parse_url($url, PHP_URL_SCHEME), ['http', 'https'])) {
Logger::info('Bad URL, quitting', ['uri-id' => $uriId, 'url' => $url, 'callstack' => System::callstack(20)]); Logger::info('Bad URL, quitting', ['uri-id' => $uriId, 'url' => $url]);
return $url; return $url;
} }

View file

@ -25,7 +25,6 @@ use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode; use Friendica\Content\Text\BBCode;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -79,7 +78,7 @@ class Media
} }
if (DBA::exists('post-media', ['uri-id' => $media['uri-id'], 'preview' => $media['url']])) { if (DBA::exists('post-media', ['uri-id' => $media['uri-id'], 'preview' => $media['url']])) {
Logger::info('Media already exists as preview', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'callstack' => System::callstack()]); Logger::info('Media already exists as preview', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
return false; return false;
} }
@ -87,12 +86,12 @@ class Media
// and embedded as picture then we only store the picture or replace the document // and embedded as picture then we only store the picture or replace the document
$found = DBA::selectFirst('post-media', ['type'], ['uri-id' => $media['uri-id'], 'url' => $media['url']]); $found = DBA::selectFirst('post-media', ['type'], ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
if (!$force && !empty($found) && (($found['type'] != self::DOCUMENT) || ($media['type'] == self::DOCUMENT))) { if (!$force && !empty($found) && (($found['type'] != self::DOCUMENT) || ($media['type'] == self::DOCUMENT))) {
Logger::info('Media already exists', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'callstack' => System::callstack()]); Logger::info('Media already exists', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
return false; return false;
} }
if (!ItemURI::exists($media['uri-id'])) { if (!ItemURI::exists($media['uri-id'])) {
Logger::info('Media referenced URI ID not found', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'callstack' => System::callstack()]); Logger::info('Media referenced URI ID not found', ['uri-id' => $media['uri-id'], 'url' => $media['url']]);
return false; return false;
} }
@ -102,7 +101,7 @@ class Media
// We are storing as fast as possible to avoid duplicated network requests // We are storing as fast as possible to avoid duplicated network requests
// when fetching additional information for pictures and other content. // when fetching additional information for pictures and other content.
$result = DBA::insert('post-media', $media, Database::INSERT_UPDATE); $result = DBA::insert('post-media', $media, Database::INSERT_UPDATE);
Logger::info('Stored media', ['result' => $result, 'media' => $media, 'callstack' => System::callstack()]); Logger::info('Stored media', ['result' => $result, 'media' => $media]);
$stored = $media; $stored = $media;
$media = self::fetchAdditionalData($media); $media = self::fetchAdditionalData($media);

View file

@ -228,7 +228,7 @@ class Profile
// System user, aborting // System user, aborting
if ($profile['uid'] === 0) { if ($profile['uid'] === 0) {
DI::logger()->warning('System user found in Profile::load', ['nickname' => $nickname, 'callstack' => System::callstack(20)]); DI::logger()->warning('System user found in Profile::load', ['nickname' => $nickname]);
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.')); throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
} }
@ -450,7 +450,7 @@ class Profile
$p['url'] = Contact::magicLinkById($cid, $profile['url']); $p['url'] = Contact::magicLinkById($cid, $profile['url']);
if (!isset($profile['hidewall'])) { if (!isset($profile['hidewall'])) {
Logger::warning('Missing hidewall key in profile array', ['profile' => $profile, 'callstack' => System::callstack(10)]); Logger::warning('Missing hidewall key in profile array', ['profile' => $profile]);
} }
if ($profile['account-type'] == Contact::TYPE_COMMUNITY) { if ($profile['account-type'] == Contact::TYPE_COMMUNITY) {

View file

@ -112,7 +112,7 @@ class Tag
} }
if ((substr($url, 0, 7) == 'https//') || (substr($url, 0, 6) == 'http//')) { if ((substr($url, 0, 7) == 'https//') || (substr($url, 0, 6) == 'http//')) {
Logger::notice('Wrong scheme in url', ['url' => $url, 'callstack' => System::callstack(20)]); Logger::notice('Wrong scheme in url', ['url' => $url]);
} }
$cid = Contact::getIdForURL($url, 0, false); $cid = Contact::getIdForURL($url, 0, false);
@ -159,7 +159,7 @@ class Tag
DBA::insert('post-tag', $fields, Database::INSERT_IGNORE); DBA::insert('post-tag', $fields, Database::INSERT_IGNORE);
Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type, 'callstack' => System::callstack(8)]); Logger::debug('Stored tag/mention', ['uri-id' => $uriId, 'tag-id' => $tagid, 'contact-id' => $cid, 'name' => $name, 'type' => $type]);
} }
/** /**
@ -316,7 +316,7 @@ class Tag
*/ */
public static function storeFromArray(array $item, string $tags = null) public static function storeFromArray(array $item, string $tags = null)
{ {
Logger::info('Check for tags', ['uri-id' => $item['uri-id'], 'hash' => $tags, 'callstack' => System::callstack()]); Logger::info('Check for tags', ['uri-id' => $item['uri-id'], 'hash' => $tags]);
if (is_null($tags)) { if (is_null($tags)) {
$tags = self::TAG_CHARACTER[self::HASHTAG] . self::TAG_CHARACTER[self::MENTION] . self::TAG_CHARACTER[self::EXCLUSIVE_MENTION]; $tags = self::TAG_CHARACTER[self::HASHTAG] . self::TAG_CHARACTER[self::MENTION] . self::TAG_CHARACTER[self::EXCLUSIVE_MENTION];
@ -347,7 +347,7 @@ class Tag
*/ */
public static function storeRawTagsFromBody(int $uriId, string $body) public static function storeRawTagsFromBody(int $uriId, string $body)
{ {
Logger::info('Check for tags', ['uri-id' => $uriId, 'callstack' => System::callstack()]); Logger::info('Check for tags', ['uri-id' => $uriId]);
$result = BBCode::getTags($body); $result = BBCode::getTags($body);
if (empty($result)) { if (empty($result)) {
@ -396,7 +396,7 @@ class Tag
return; return;
} }
Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url, 'callstack' => System::callstack(8)]); Logger::debug('Removing tag/mention', ['uri-id' => $uriId, 'tid' => $tag['tid'], 'name' => $name, 'url' => $url]);
DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]); DBA::delete('post-tag', ['uri-id' => $uriId, 'type' => $type, 'tid' => $tag['tid'], 'cid' => $tag['cid']]);
} }

View file

@ -962,7 +962,7 @@ class User
public static function getAvatarUrl(array $user, string $size = ''): string public static function getAvatarUrl(array $user, string $size = ''): string
{ {
if (empty($user['nickname'])) { if (empty($user['nickname'])) {
DI::logger()->warning('Missing user nickname key', ['trace' => System::callstack(20)]); DI::logger()->warning('Missing user nickname key');
} }
$url = DI::baseUrl() . '/photo/'; $url = DI::baseUrl() . '/photo/';
@ -1004,7 +1004,7 @@ class User
public static function getBannerUrl(array $user): string public static function getBannerUrl(array $user): string
{ {
if (empty($user['nickname'])) { if (empty($user['nickname'])) {
DI::logger()->warning('Missing user nickname key', ['trace' => System::callstack(20)]); DI::logger()->warning('Missing user nickname key');
} }
$url = DI::baseUrl() . '/photo/banner/'; $url = DI::baseUrl() . '/photo/banner/';

View file

@ -74,8 +74,10 @@ class Statuses extends BaseApi
} elseif ($request['only_media']) { } elseif ($request['only_media']) {
$condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'type' => [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]]; $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], 'type' => [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]];
} elseif (!$uid) { } elseif (!$uid) {
$condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], $condition = [
'uid' => 0, 'network' => Protocol::FEDERATED]; 'author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED],
'uid' => 0, 'network' => Protocol::FEDERATED
];
} else { } else {
$condition = ["`author-id` = ? AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))", $id, $uid]; $condition = ["`author-id` = ? AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))", $id, $uid];
} }
@ -85,11 +87,15 @@ class Statuses extends BaseApi
if (!$request['pinned'] && !$request['only_media']) { if (!$request['pinned'] && !$request['only_media']) {
if ($request['exclude_replies']) { if ($request['exclude_replies']) {
$condition = DBA::mergeConditions($condition, ["(`gravity` = ? OR (`gravity` = ? AND `vid` = ? AND `protocol` != ?))", $condition = DBA::mergeConditions($condition, [
Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA]); "(`gravity` = ? OR (`gravity` = ? AND `vid` = ? AND `protocol` != ?))",
Item::GRAVITY_PARENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA
]);
} else { } else {
$condition = DBA::mergeConditions($condition, ["(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ? AND `protocol` != ?))", $condition = DBA::mergeConditions($condition, [
Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA]); "(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ? AND `protocol` != ?))",
Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, Item::GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE), Conversation::PARCEL_DIASPORA
]);
} }
} elseif ($request['exclude_replies']) { } elseif ($request['exclude_replies']) {
$condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]);
@ -100,7 +106,7 @@ class Statuses extends BaseApi
} elseif ($request['only_media']) { } elseif ($request['only_media']) {
$items = DBA::select('media-view', ['uri-id'], $condition, $params); $items = DBA::select('media-view', ['uri-id'], $condition, $params);
} else { } else {
$items = Post::selectForUser($uid, ['uri-id'], $condition, $params); $items = Post::selectTimelineForUser($uid, ['uri-id'], $condition, $params);
} }
$display_quotes = self::appSupportsQuotes(); $display_quotes = self::appSupportsQuotes();

View file

@ -22,7 +22,6 @@
namespace Friendica\Module\Api\Mastodon\Timelines; namespace Friendica\Module\Api\Mastodon\Timelines;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -67,8 +66,10 @@ class Home extends BaseApi
} }
if ($request['only_media']) { if ($request['only_media']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", $condition = DBA::mergeConditions($condition, [
Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); "`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))",
Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO
]);
} }
if ($request['remote']) { if ($request['remote']) {
@ -79,7 +80,7 @@ class Home extends BaseApi
$condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]);
} }
$items = Post::selectForUser($uid, ['uri-id'], $condition, $params); $items = Post::selectTimelineForUser($uid, ['uri-id'], $condition, $params);
$display_quotes = self::appSupportsQuotes(); $display_quotes = self::appSupportsQuotes();

View file

@ -61,15 +61,19 @@ class ListTimeline extends BaseApi
'friendica_order' => TimelineOrderByTypes::ID, // Sort order options (defaults to ID) 'friendica_order' => TimelineOrderByTypes::ID, // Sort order options (defaults to ID)
], $request); ], $request);
$condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", $condition = [
$uid, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, $this->parameters['id']]; "`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)",
$uid, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT, $this->parameters['id']
];
$condition = $this->addPagingConditions($request, $condition); $condition = $this->addPagingConditions($request, $condition);
$params = $this->buildOrderAndLimitParams($request); $params = $this->buildOrderAndLimitParams($request);
if ($request['only_media']) { if ($request['only_media']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", $condition = DBA::mergeConditions($condition, [
Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); "`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))",
Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO
]);
} }
if ($request['exclude_replies']) { if ($request['exclude_replies']) {
@ -84,7 +88,7 @@ class ListTimeline extends BaseApi
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin` AND `post-user`.`uri-id` = `post-user-view`.`uri-id`)"]); $condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin` AND `post-user`.`uri-id` = `post-user-view`.`uri-id`)"]);
} }
$items = Post::selectForUser($uid, ['uri-id'], $condition, $params); $items = Post::selectTimelineForUser($uid, ['uri-id'], $condition, $params);
$display_quotes = self::appSupportsQuotes(); $display_quotes = self::appSupportsQuotes();

View file

@ -23,7 +23,6 @@ namespace Friendica\Module\Api\Mastodon\Timelines;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Item; use Friendica\Model\Item;
@ -57,30 +56,36 @@ class PublicTimeline extends BaseApi
'friendica_order' => TimelineOrderByTypes::ID, // Sort order options (defaults to ID) 'friendica_order' => TimelineOrderByTypes::ID, // Sort order options (defaults to ID)
], $request); ], $request);
$condition = ['gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'private' => Item::PUBLIC, $condition = [
'network' => Protocol::FEDERATED, 'author-blocked' => false, 'author-hidden' => false]; 'gravity' => [Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT], 'private' => Item::PUBLIC,
'network' => Protocol::FEDERATED, 'author-blocked' => false, 'author-hidden' => false
];
$condition = $this->addPagingConditions($request, $condition); $condition = $this->addPagingConditions($request, $condition);
$params = $this->buildOrderAndLimitParams($request); $params = $this->buildOrderAndLimitParams($request);
if ($request['local']) { if ($request['local']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]); $condition = DBA::mergeConditions($condition, ['origin' => true]);
} else {
$condition = DBA::mergeConditions($condition, ['uid' => 0]);
} }
if ($request['remote']) { if ($request['remote']) {
$condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin` AND `post-user`.`uri-id` = `post-view`.`uri-id`)"]); $condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin` AND `post-user`.`uri-id` = `post-timeline-view`.`uri-id`)"]);
} }
if ($request['only_media']) { if ($request['only_media']) {
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", $condition = DBA::mergeConditions($condition, [
Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); "`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))",
Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO
]);
} }
if ($request['exclude_replies']) { if ($request['exclude_replies']) {
$condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]); $condition = DBA::mergeConditions($condition, ['gravity' => Item::GRAVITY_PARENT]);
} }
$items = Post::selectPostsForUser($uid, ['uri-id'], $condition, $params); $items = Post::selectTimelineForUser($uid, ['uri-id'], $condition, $params);
$display_quotes = self::appSupportsQuotes(); $display_quotes = self::appSupportsQuotes();

View file

@ -29,7 +29,6 @@ use Friendica\Content\Widget;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\Renderer; use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\Core\Theme; use Friendica\Core\Theme;
use Friendica\Core\Worker; use Friendica\Core\Worker;
use Friendica\Database\DBA; use Friendica\Database\DBA;
@ -140,7 +139,7 @@ class Contact extends BaseModule
try { try {
UpdateContact::add(Worker::PRIORITY_HIGH, $contact_id); UpdateContact::add(Worker::PRIORITY_HIGH, $contact_id);
} catch (\InvalidArgumentException $e) { } catch (\InvalidArgumentException $e) {
Logger::notice($e->getMessage(), ['contact' => $contact, 'callstack' => System::callstack()]); Logger::notice($e->getMessage(), ['contact' => $contact]);
} }
} }
} }

View file

@ -138,7 +138,6 @@ class HTTPException
'code' => $e->getCode(), 'code' => $e->getCode(),
'description' => $e->getDescription(), 'description' => $e->getDescription(),
'query' => $this->args->getQueryString(), 'query' => $this->args->getQueryString(),
'callstack' => System::callstack(20),
'method' => $this->args->getMethod(), 'method' => $this->args->getMethod(),
'agent' => $this->server['HTTP_USER_AGENT'] ?? '' 'agent' => $this->server['HTTP_USER_AGENT'] ?? ''
]); ]);

View file

@ -226,7 +226,7 @@ class Notify extends BaseRepository
// Temporary logging for finding the origin // Temporary logging for finding the origin
if (!isset($params['uid'])) { if (!isset($params['uid'])) {
$this->logger->notice('Missing parameters "uid".', ['params' => $params, 'callstack' => System::callstack()]); $this->logger->notice('Missing parameters "uid".', ['params' => $params]);
} }
// Ensure that the important fields are set at any time // Ensure that the important fields are set at any time

View file

@ -22,7 +22,6 @@
namespace Friendica\Network\Factory; namespace Friendica\Network\Factory;
use Friendica\BaseFactory; use Friendica\BaseFactory;
use Friendica\Core\System;
use Friendica\Network\Entity; use Friendica\Network\Entity;
/** /**
@ -43,7 +42,7 @@ class MimeType extends BaseFactory
$filetype = strtolower($types[0]); $filetype = strtolower($types[0]);
$subtype = strtolower($types[1]); $subtype = strtolower($types[1]);
} else { } else {
$this->logger->notice('Unknown MimeType', ['type' => $contentType, 'callstack' => System::callstack(10)]); $this->logger->notice('Unknown MimeType', ['type' => $contentType]);
} }
$parameters = []; $parameters = [];

View file

@ -74,17 +74,17 @@ class HttpClient implements ICanSendHttpRequests
} }
if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA)) { if(!filter_var($host, FILTER_VALIDATE_IP) && !@dns_get_record($host . '.', DNS_A + DNS_AAAA)) {
$this->logger->debug('URL cannot be resolved.', ['url' => $url, 'callstack' => System::callstack(20)]); $this->logger->debug('URL cannot be resolved.', ['url' => $url]);
$this->profiler->stopRecording(); $this->profiler->stopRecording();
return CurlResult::createErrorCurl($this->logger, $url); return CurlResult::createErrorCurl($this->logger, $url);
} }
if (Network::isLocalLink($url)) { if (Network::isLocalLink($url)) {
$this->logger->info('Local link', ['url' => $url, 'callstack' => System::callstack(20)]); $this->logger->info('Local link', ['url' => $url]);
} }
if (strlen($url) > 1000) { if (strlen($url) > 1000) {
$this->logger->debug('URL is longer than 1000 characters.', ['url' => $url, 'callstack' => System::callstack(20)]); $this->logger->debug('URL is longer than 1000 characters.', ['url' => $url]);
$this->profiler->stopRecording(); $this->profiler->stopRecording();
return CurlResult::createErrorCurl($this->logger, substr($url, 0, 200)); return CurlResult::createErrorCurl($this->logger, substr($url, 0, 200));
} }
@ -160,7 +160,7 @@ class HttpClient implements ICanSendHttpRequests
}; };
if (empty($conf[HttpClientOptions::HEADERS]['Accept']) && in_array($method, ['get', 'head'])) { if (empty($conf[HttpClientOptions::HEADERS]['Accept']) && in_array($method, ['get', 'head'])) {
$this->logger->info('Accept header was missing, using default.', ['url' => $url, 'callstack' => System::callstack()]); $this->logger->info('Accept header was missing, using default.', ['url' => $url]);
$conf[HttpClientOptions::HEADERS]['Accept'] = HttpClientAccept::DEFAULT; $conf[HttpClientOptions::HEADERS]['Accept'] = HttpClientAccept::DEFAULT;
} }
@ -238,7 +238,7 @@ class HttpClient implements ICanSendHttpRequests
$this->profiler->startRecording('network'); $this->profiler->startRecording('network');
if (Network::isLocalLink($url)) { if (Network::isLocalLink($url)) {
$this->logger->debug('Local link', ['url' => $url, 'callstack' => System::callstack(20)]); $this->logger->debug('Local link', ['url' => $url]);
} }
if (Network::isUrlBlocked($url)) { if (Network::isUrlBlocked($url)) {

View file

@ -27,7 +27,6 @@ use Exception;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\Protocol; use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Model\Contact; use Friendica\Model\Contact;
@ -219,7 +218,7 @@ class Probe
$xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20);
Logger::info('Probing', ['host' => $host, 'ssl_url' => $ssl_url, 'url' => $url, 'callstack' => System::callstack(20)]); Logger::info('Probing', ['host' => $host, 'ssl_url' => $ssl_url, 'url' => $url]);
$xrd = null; $xrd = null;
$curlResult = DI::httpClient()->get($ssl_url, HttpClientAccept::XRD_XML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); $curlResult = DI::httpClient()->get($ssl_url, HttpClientAccept::XRD_XML, [HttpClientOptions::TIMEOUT => $xrd_timeout]);

View file

@ -42,7 +42,6 @@ use Friendica\Model\Mail;
use Friendica\Model\Tag; use Friendica\Model\Tag;
use Friendica\Model\User; use Friendica\Model\User;
use Friendica\Model\Post; use Friendica\Model\Post;
use Friendica\Moderation\Entity\Report;
use Friendica\Protocol\Activity; use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub; use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\Delivery; use Friendica\Protocol\Delivery;
@ -472,7 +471,7 @@ class Processor
$item['uri'] = $activity['id']; $item['uri'] = $activity['id'];
if (empty($activity['published']) || empty($activity['updated'])) { if (empty($activity['published']) || empty($activity['updated'])) {
DI::logger()->notice('published or updated keys are empty for activity', ['activity' => $activity, 'callstack' => System::callstack(10)]); DI::logger()->notice('published or updated keys are empty for activity', ['activity' => $activity]);
} }
$item['created'] = DateTimeFormat::utc($activity['published'] ?? 'now'); $item['created'] = DateTimeFormat::utc($activity['published'] ?? 'now');

View file

@ -22,7 +22,6 @@
namespace Friendica\Protocol\ActivityPub; namespace Friendica\Protocol\ActivityPub;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\DBA; use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
@ -214,7 +213,7 @@ class Queue
} }
} }
Logger::debug('Processing queue entry', ['id' => $entry['id'], 'type' => $entry['type'], 'object-type' => $entry['object-type'], 'uri' => $entry['object-id'], 'in-reply-to' => $entry['in-reply-to-id'], 'callstack' => System::callstack(20)]); Logger::debug('Processing queue entry', ['id' => $entry['id'], 'type' => $entry['type'], 'object-type' => $entry['object-type'], 'uri' => $entry['object-id'], 'in-reply-to' => $entry['in-reply-to-id']]);
$activity = json_decode($entry['activity'], true); $activity = json_decode($entry['activity'], true);
$type = $entry['type']; $type = $entry['type'];

View file

@ -625,7 +625,7 @@ class Receiver
// $trust_source is called by reference and is set to true if the content was retrieved successfully // $trust_source is called by reference and is set to true if the content was retrieved successfully
$object_data = self::prepareObjectData($activity, $uid, $push, $trust_source, $original_actor); $object_data = self::prepareObjectData($activity, $uid, $push, $trust_source, $original_actor);
if (empty($object_data)) { if (empty($object_data)) {
Logger::info('No object data found', ['activity' => $activity, 'callstack' => System::callstack(20)]); Logger::info('No object data found', ['activity' => $activity]);
return true; return true;
} }
@ -1077,7 +1077,7 @@ class Receiver
foreach ($receiver_list as $receiver) { foreach ($receiver_list as $receiver) {
if ($receiver == 'Public') { if ($receiver == 'Public') {
Logger::warning('Not compacted public collection found', ['activity' => $activity, 'callstack' => System::callstack(20)]); Logger::warning('Not compacted public collection found', ['activity' => $activity]);
$receiver = ActivityPub::PUBLIC_COLLECTION; $receiver = ActivityPub::PUBLIC_COLLECTION;
} }
if ($receiver == self::PUBLIC_COLLECTION) { if ($receiver == self::PUBLIC_COLLECTION) {
@ -1234,7 +1234,7 @@ class Receiver
} elseif (empty($receivers) && in_array($activity_type, ['as:Delete', 'as:Undo'])) { } elseif (empty($receivers) && in_array($activity_type, ['as:Delete', 'as:Undo'])) {
$receivers[0] = ['uid' => 0, 'type' => self::TARGET_GLOBAL]; $receivers[0] = ['uid' => 0, 'type' => self::TARGET_GLOBAL];
} elseif (empty($receivers)) { } elseif (empty($receivers)) {
Logger::notice('Post has got no receivers', ['fetch_unlisted' => $fetch_unlisted, 'actor' => $actor, 'id' => JsonLD::fetchElement($activity, '@id'), 'type' => $activity_type, 'callstack' => System::callstack(20)]); Logger::notice('Post has got no receivers', ['fetch_unlisted' => $fetch_unlisted, 'actor' => $actor, 'id' => JsonLD::fetchElement($activity, '@id'), 'type' => $activity_type]);
} }
return $receivers; return $receivers;

View file

@ -347,7 +347,7 @@ class Transmitter
{ {
$owner = User::getOwnerDataById($uid); $owner = User::getOwnerDataById($uid);
if (!isset($owner['id'])) { if (!isset($owner['id'])) {
DI::logger()->error('Unable to find owner data for uid', ['uid' => $uid, 'callstack' => System::callstack(20)]); DI::logger()->error('Unable to find owner data for uid', ['uid' => $uid]);
throw new HTTPException\NotFoundException('User not found.'); throw new HTTPException\NotFoundException('User not found.');
} }

View file

@ -796,7 +796,7 @@ class Diaspora
*/ */
private static function key(WebFingerUri $uri): string private static function key(WebFingerUri $uri): string
{ {
Logger::info('Fetching diaspora key', ['handle' => $uri->getAddr(), 'callstack' => System::callstack(20)]); Logger::info('Fetching diaspora key', ['handle' => $uri->getAddr()]);
try { try {
return DI::dsprContact()->getByAddr($uri)->pubKey; return DI::dsprContact()->getByAddr($uri)->pubKey;
} catch (HTTPException\NotFoundException | \InvalidArgumentException $e) { } catch (HTTPException\NotFoundException | \InvalidArgumentException $e) {
@ -3022,7 +3022,7 @@ class Diaspora
// The "addr" field should always be filled. // The "addr" field should always be filled.
// If this isn't the case, it will raise a notice some lines later. // If this isn't the case, it will raise a notice some lines later.
// And in the log we will see where it came from, and we can handle it there. // And in the log we will see where it came from, and we can handle it there.
Logger::notice('Empty addr', ['contact' => $contact ?? [], 'callstack' => System::callstack(20)]); Logger::notice('Empty addr', ['contact' => $contact ?? []]);
} }
$envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $pubkey ?? '', $public_batch); $envelope = self::buildMessage($msg, $owner, $contact, $owner['uprvkey'], $pubkey ?? '', $public_batch);

View file

@ -22,7 +22,6 @@
namespace Friendica\Protocol\Diaspora\Repository; namespace Friendica\Protocol\Diaspora\Repository;
use Friendica\BaseRepository; use Friendica\BaseRepository;
use Friendica\Core\System;
use Friendica\Database\Database; use Friendica\Database\Database;
use Friendica\Database\Definition\DbaDefinition; use Friendica\Database\Definition\DbaDefinition;
use Friendica\Model\APContact; use Friendica\Model\APContact;
@ -273,7 +272,7 @@ class DiasporaContact extends BaseRepository
$DiasporaContact = $this->save($DiasporaContact); $DiasporaContact = $this->save($DiasporaContact);
$this->logger->info('Updated diaspora-contact', ['url' => (string) $DiasporaContact->url, 'callstack' => System::callstack(20)]); $this->logger->info('Updated diaspora-contact', ['url' => (string) $DiasporaContact->url]);
return $DiasporaContact; return $DiasporaContact;
} }

View file

@ -23,7 +23,6 @@ namespace Friendica\Util;
use Friendica\Core\Hook; use Friendica\Core\Hook;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\DI; use Friendica\DI;
use phpseclib3\Crypt\PublicKeyLoader; use phpseclib3\Crypt\PublicKeyLoader;
@ -42,7 +41,7 @@ class Crypto
public static function rsaSign($data, $key, $alg = 'sha256') public static function rsaSign($data, $key, $alg = 'sha256')
{ {
if (empty($key)) { if (empty($key)) {
Logger::warning('Empty key parameter', ['callstack' => System::callstack()]); Logger::warning('Empty key parameter');
} }
openssl_sign($data, $sig, $key, (($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg)); openssl_sign($data, $sig, $key, (($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg));
return $sig; return $sig;
@ -58,7 +57,7 @@ class Crypto
public static function rsaVerify($data, $sig, $key, $alg = 'sha256') public static function rsaVerify($data, $sig, $key, $alg = 'sha256')
{ {
if (empty($key)) { if (empty($key)) {
Logger::warning('Empty key parameter', ['callstack' => System::callstack()]); Logger::warning('Empty key parameter');
} }
return openssl_verify($data, $sig, $key, (($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg)); return openssl_verify($data, $sig, $key, (($alg == 'sha1') ? OPENSSL_ALGO_SHA1 : $alg));
} }

View file

@ -208,7 +208,7 @@ class JsonLD
Logger::notice('compacting error', ['msg' => $e->getMessage(), 'previous' => $e->getPrevious(), 'line' => $e->getLine()]); Logger::notice('compacting error', ['msg' => $e->getMessage(), 'previous' => $e->getPrevious(), 'line' => $e->getLine()]);
if ($logfailed && DI::config()->get('debug', 'ap_log_failure')) { if ($logfailed && DI::config()->get('debug', 'ap_log_failure')) {
$tempfile = tempnam(System::getTempPath(), 'failed-jsonld'); $tempfile = tempnam(System::getTempPath(), 'failed-jsonld');
file_put_contents($tempfile, json_encode(['json' => $orig_json, 'callstack' => System::callstack(20), 'msg' => $e->getMessage(), 'previous' => $e->getPrevious()], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); file_put_contents($tempfile, json_encode(['json' => $orig_json, 'msg' => $e->getMessage(), 'previous' => $e->getPrevious()], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT));
Logger::notice('Failed message stored', ['file' => $tempfile]); Logger::notice('Failed message stored', ['file' => $tempfile]);
} }
} }

View file

@ -116,7 +116,7 @@ class Proxy
$size = ':' . $size; $size = ':' . $size;
} }
Logger::info('Created proxy link', ['url' => $url, 'callstack' => System::callstack(20)]); Logger::info('Created proxy link', ['url' => $url]);
// Too long files aren't supported by Apache // Too long files aren't supported by Apache
if (strlen($proxypath) > 250) { if (strlen($proxypath) > 250) {

View file

@ -23,7 +23,6 @@ namespace Friendica\Util;
use Friendica\Content\ContactSelector; use Friendica\Content\ContactSelector;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use ParagonIE\ConstantTime\Base64; use ParagonIE\ConstantTime\Base64;
/** /**
@ -511,7 +510,7 @@ class Strings
); );
if (is_null($return)) { if (is_null($return)) {
Logger::notice('Received null value from preg_replace_callback', ['text' => $text, 'regex' => $regex, 'blocks' => $blocks, 'executionId' => $executionId, 'callstack' => System::callstack(10)]); Logger::notice('Received null value from preg_replace_callback', ['text' => $text, 'regex' => $regex, 'blocks' => $blocks, 'executionId' => $executionId]);
} }
$text = $callback($return ?? $text) ?? ''; $text = $callback($return ?? $text) ?? '';

View file

@ -26,7 +26,6 @@ use DOMElement;
use DOMNode; use DOMNode;
use DOMXPath; use DOMXPath;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System;
use SimpleXMLElement; use SimpleXMLElement;
/** /**
@ -451,7 +450,7 @@ class XML
$x = @simplexml_load_string($s); $x = @simplexml_load_string($s);
if (!$x) { if (!$x) {
if (!$suppress_log) { if (!$suppress_log) {
Logger::error('Error(s) while parsing XML string.', ['callstack' => System::callstack()]); Logger::error('Error(s) while parsing XML string.');
foreach (libxml_get_errors() as $err) { foreach (libxml_get_errors() as $err) {
Logger::info('libxml error', ['code' => $err->code, 'position' => $err->line . ':' . $err->column, 'message' => $err->message]); Logger::info('libxml error', ['code' => $err->code, 'position' => $err->line . ':' . $err->column, 'message' => $err->message]);
} }

View file

@ -56,7 +56,7 @@ use Friendica\Database\DBA;
// This file is required several times during the test in DbaDefinition which justifies this condition // This file is required several times during the test in DbaDefinition which justifies this condition
if (!defined('DB_UPDATE_VERSION')) { if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1537); define('DB_UPDATE_VERSION', 1538);
} }
return [ return [

View file

@ -87,6 +87,49 @@
INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id` INNER JOIN `contact` ON `group_member`.`contact-id` = `contact`.`id`
INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`" INNER JOIN `group` ON `group_member`.`gid` = `group`.`id`"
], ],
"post-timeline-view" => [
"fields" => [
"uid" => ["post-user", "uid"],
"uri-id" => ["post-user", "uri-id"],
"gravity" => ["post-user", "gravity"],
"created" => ["post-user", "created"],
"edited" => ["post-user", "edited"],
"commented" => ["post-thread-user", "commented"],
"received" => ["post-user", "received"],
"changed" => ["post-thread-user", "changed"],
"private" => ["post-user", "private"],
"visible" => ["post-user", "visible"],
"deleted" => ["post-user", "deleted"],
"origin" => ["post-user", "origin"],
"global" => ["post-user", "global"],
"network" => ["post-user", "network"],
"protocol" => ["post-user", "protocol"],
"vid" => ["post-user", "vid"],
"contact-id" => ["post-user", "contact-id"],
"contact-blocked" => ["contact", "blocked"],
"contact-readonly" => ["contact", "readonly"],
"contact-pending" => ["contact", "pending"],
"contact-rel" => ["contact", "rel"],
"contact-uid" => ["contact", "uid"],
"self" => ["contact", "self"],
"author-id" => ["post-user", "author-id"],
"author-blocked" => ["author", "blocked"],
"author-hidden" => ["author", "hidden"],
"author-gsid" => ["author", "gsid"],
"owner-id" => ["post-user", "owner-id"],
"owner-blocked" => ["owner", "blocked"],
"owner-gsid" => ["owner", "gsid"],
"causer-id" => ["post-user", "causer-id"],
"causer-blocked" => ["causer", "blocked"],
"causer-gsid" => ["causer", "gsid"],
],
"query" => "FROM `post-user`
LEFT JOIN `post-thread-user` ON `post-thread-user`.`uri-id` = `post-user`.`parent-uri-id` AND `post-thread-user`.`uid` = `post-user`.`uid`
STRAIGHT_JOIN `contact` ON `contact`.`id` = `post-user`.`contact-id`
STRAIGHT_JOIN `contact` AS `author` ON `author`.`id` = `post-user`.`author-id`
STRAIGHT_JOIN `contact` AS `owner` ON `owner`.`id` = `post-user`.`owner-id`
LEFT JOIN `contact` AS `causer` ON `causer`.`id` = `post-user`.`causer-id`"
],
"post-user-view" => [ "post-user-view" => [
"fields" => [ "fields" => [
"id" => ["post-user", "id"], "id" => ["post-user", "id"],