mirror of
https://github.com/friendica/friendica
synced 2025-02-12 07:34:01 +00:00
Replace Logger with DI::logger() in Content namespace
This commit is contained in:
parent
d4c90d41a0
commit
8c89c37775
5 changed files with 17 additions and 22 deletions
|
@ -14,7 +14,6 @@ use Friendica\Content\Text\BBCode\Video;
|
||||||
use Friendica\Content\Text\HTML;
|
use Friendica\Content\Text\HTML;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
use Friendica\Core\PConfig\Capability\IManagePersonalConfigValues;
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
||||||
|
@ -520,18 +519,18 @@ class Item
|
||||||
$only_to_group = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
|
$only_to_group = ($tag[1] == Tag::TAG_CHARACTER[Tag::EXCLUSIVE_MENTION]);
|
||||||
$private_id = $contact['id'];
|
$private_id = $contact['id'];
|
||||||
$group_contact = $contact;
|
$group_contact = $contact;
|
||||||
Logger::info('Private group or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
|
DI::logger()->info('Private group or exclusive mention', ['url' => $tag[2], 'mention' => $tag[1]]);
|
||||||
} elseif ($item['allow_cid'] == '<' . $contact['id'] . '>') {
|
} elseif ($item['allow_cid'] == '<' . $contact['id'] . '>') {
|
||||||
$private_group = false;
|
$private_group = false;
|
||||||
$only_to_group = true;
|
$only_to_group = true;
|
||||||
$private_id = $contact['id'];
|
$private_id = $contact['id'];
|
||||||
$group_contact = $contact;
|
$group_contact = $contact;
|
||||||
Logger::info('Public group', ['url' => $tag[2], 'mention' => $tag[1]]);
|
DI::logger()->info('Public group', ['url' => $tag[2], 'mention' => $tag[1]]);
|
||||||
} else {
|
} else {
|
||||||
Logger::info('Post with group mention will not be converted to a group post', ['url' => $tag[2], 'mention' => $tag[1]]);
|
DI::logger()->info('Post with group mention will not be converted to a group post', ['url' => $tag[2], 'mention' => $tag[1]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Logger::info('Got inform', ['inform' => $item['inform']]);
|
DI::logger()->info('Got inform', ['inform' => $item['inform']]);
|
||||||
|
|
||||||
if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($group_contact) && ($private_group || $only_to_group)) {
|
if (($item['gravity'] == ItemModel::GRAVITY_PARENT) && !empty($group_contact) && ($private_group || $only_to_group)) {
|
||||||
// we tagged a group in a top level post. Now we change the post
|
// we tagged a group in a top level post. Now we change the post
|
||||||
|
@ -638,7 +637,7 @@ class Item
|
||||||
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network', 'quote-uri-id'];
|
$fields = ['uri-id', 'uri', 'body', 'title', 'author-name', 'author-link', 'author-avatar', 'guid', 'created', 'plink', 'network', 'quote-uri-id'];
|
||||||
$shared_item = Post::selectFirst($fields, ['uri-id' => $item['quote-uri-id'], 'uid' => [$item['uid'], 0], 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
|
$shared_item = Post::selectFirst($fields, ['uri-id' => $item['quote-uri-id'], 'uid' => [$item['uid'], 0], 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
|
||||||
if (!DBA::isResult($shared_item)) {
|
if (!DBA::isResult($shared_item)) {
|
||||||
Logger::notice('Post does not exist.', ['uri-id' => $item['quote-uri-id'], 'uid' => $item['uid']]);
|
DI::logger()->notice('Post does not exist.', ['uri-id' => $item['quote-uri-id'], 'uid' => $item['uid']]);
|
||||||
return $body;
|
return $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +653,7 @@ class Item
|
||||||
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => 0, 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
|
$shared_item = Post::selectFirst($fields, ['guid' => $guid, 'uid' => 0, 'private' => [ItemModel::PUBLIC, ItemModel::UNLISTED]]);
|
||||||
|
|
||||||
if (!DBA::isResult($shared_item)) {
|
if (!DBA::isResult($shared_item)) {
|
||||||
Logger::notice('Post does not exist.', ['guid' => $guid]);
|
DI::logger()->notice('Post does not exist.', ['guid' => $guid]);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1087,7 +1086,7 @@ class Item
|
||||||
$expire_date = time() - ($expire_interval * 86400);
|
$expire_date = time() - ($expire_interval * 86400);
|
||||||
$created_date = strtotime($created);
|
$created_date = strtotime($created);
|
||||||
if ($created_date < $expire_date) {
|
if ($created_date < $expire_date) {
|
||||||
Logger::notice('Item created before expiration interval.', ['created' => date('c', $created_date), 'expired' => date('c', $expire_date)]);
|
DI::logger()->notice('Item created before expiration interval.', ['created' => date('c', $created_date), 'expired' => date('c', $expire_date)]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
namespace Friendica\Content;
|
namespace Friendica\Content;
|
||||||
|
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Util\ParseUrl;
|
use Friendica\Util\ParseUrl;
|
||||||
|
@ -28,7 +27,7 @@ class PageInfo
|
||||||
*/
|
*/
|
||||||
public static function searchAndAppendToBody(string $body, bool $searchNakedUrls = false, bool $no_photos = false)
|
public static function searchAndAppendToBody(string $body, bool $searchNakedUrls = false, bool $no_photos = false)
|
||||||
{
|
{
|
||||||
Logger::debug('add_page_info_to_body: fetch page info for body', ['body' => $body]);
|
DI::logger()->debug('add_page_info_to_body: fetch page info for body', ['body' => $body]);
|
||||||
|
|
||||||
$url = self::getRelevantUrlFromBody($body, $searchNakedUrls);
|
$url = self::getRelevantUrlFromBody($body, $searchNakedUrls);
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
|
@ -194,7 +193,7 @@ class PageInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger::debug('fetch page info for URL', ['url' => $url, 'data' => $data]);
|
DI::logger()->debug('fetch page info for URL', ['url' => $url, 'data' => $data]);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ use Friendica\Content\OEmbed;
|
||||||
use Friendica\Content\PageInfo;
|
use Friendica\Content\PageInfo;
|
||||||
use Friendica\Content\Smilies;
|
use Friendica\Content\Smilies;
|
||||||
use Friendica\Core\Hook;
|
use Friendica\Core\Hook;
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -328,7 +327,7 @@ class BBCode
|
||||||
// than the maximum, then don't waste time looking for the images
|
// than the maximum, then don't waste time looking for the images
|
||||||
if ($maxlen && (strlen($body) > $maxlen)) {
|
if ($maxlen && (strlen($body) > $maxlen)) {
|
||||||
|
|
||||||
Logger::info('the total body length exceeds the limit', ['maxlen' => $maxlen, 'body_len' => strlen($body)]);
|
DI::logger()->info('the total body length exceeds the limit', ['maxlen' => $maxlen, 'body_len' => strlen($body)]);
|
||||||
|
|
||||||
$orig_body = $body;
|
$orig_body = $body;
|
||||||
$new_body = '';
|
$new_body = '';
|
||||||
|
@ -348,7 +347,7 @@ class BBCode
|
||||||
|
|
||||||
if (($textlen + $img_start) > $maxlen) {
|
if (($textlen + $img_start) > $maxlen) {
|
||||||
if ($textlen < $maxlen) {
|
if ($textlen < $maxlen) {
|
||||||
Logger::debug('the limit happens before an embedded image');
|
DI::logger()->debug('the limit happens before an embedded image');
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
|
@ -362,7 +361,7 @@ class BBCode
|
||||||
|
|
||||||
if (($textlen + $img_end) > $maxlen) {
|
if (($textlen + $img_end) > $maxlen) {
|
||||||
if ($textlen < $maxlen) {
|
if ($textlen < $maxlen) {
|
||||||
Logger::debug('the limit happens before the end of a non-embedded image');
|
DI::logger()->debug('the limit happens before the end of a non-embedded image');
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
|
@ -385,11 +384,11 @@ class BBCode
|
||||||
|
|
||||||
if (($textlen + strlen($orig_body)) > $maxlen) {
|
if (($textlen + strlen($orig_body)) > $maxlen) {
|
||||||
if ($textlen < $maxlen) {
|
if ($textlen < $maxlen) {
|
||||||
Logger::debug('the limit happens after the end of the last image');
|
DI::logger()->debug('the limit happens after the end of the last image');
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger::debug('the text size with embedded images extracted did not violate the limit');
|
DI::logger()->debug('the text size with embedded images extracted did not violate the limit');
|
||||||
$new_body = $new_body . $orig_body;
|
$new_body = $new_body . $orig_body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2107,7 +2106,7 @@ class BBCode
|
||||||
try {
|
try {
|
||||||
return (string)Uri::fromParts($parts);
|
return (string)Uri::fromParts($parts);
|
||||||
} catch (\Throwable $th) {
|
} catch (\Throwable $th) {
|
||||||
Logger::notice('Exception on unparsing url', ['url' => $url, 'parts' => $parts, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
|
DI::logger()->notice('Exception on unparsing url', ['url' => $url, 'parts' => $parts, 'code' => $th->getCode(), 'message' => $th->getMessage()]);
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
namespace Friendica\Content\Text;
|
namespace Friendica\Content\Text;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
|
||||||
|
@ -97,7 +96,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');
|
DI::logger()->warning('Received null value');
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ namespace Friendica\Content\Widget;
|
||||||
|
|
||||||
use Friendica\Content\ContactSelector;
|
use Friendica\Content\ContactSelector;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\Renderer;
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
|
@ -34,7 +33,7 @@ class VCard
|
||||||
public static function getHTML(array $contact, bool $hide_mention = false, bool $hide_follow = false): string
|
public static function getHTML(array $contact, bool $hide_mention = false, bool $hide_follow = false): string
|
||||||
{
|
{
|
||||||
if (!isset($contact['network']) || !isset($contact['id'])) {
|
if (!isset($contact['network']) || !isset($contact['id'])) {
|
||||||
Logger::warning('Incomplete contact', ['contact' => $contact]);
|
DI::logger()->warning('Incomplete contact', ['contact' => $contact]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact_url = Contact::getProfileLink($contact);
|
$contact_url = Contact::getProfileLink($contact);
|
||||||
|
|
Loading…
Add table
Reference in a new issue