From 32e6126552cfbd5fa88e099f2a7779df79a94f8f Mon Sep 17 00:00:00 2001 From: Philipp Date: Mon, 14 Aug 2023 19:30:29 +0200 Subject: [PATCH 1/3] Update db_user-contact.md --- doc/database/db_user-contact.md | 44 ++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/database/db_user-contact.md b/doc/database/db_user-contact.md index 71fdc14e4..ac89aab1d 100644 --- a/doc/database/db_user-contact.md +++ b/doc/database/db_user-contact.md @@ -6,28 +6,28 @@ User specific public contact data Fields ------ -| Field | Description | Type | Null | Key | Default | Extra | -| ------------------------- | ------------------------------------------------------------ | ------------------ | ---- | --- | ------- | ----- | -| cid | Contact id of the linked public contact | int unsigned | NO | PRI | 0 | | -| uid | User id | mediumint unsigned | NO | PRI | 0 | | -| uri-id | Id of the item-uri table entry that contains the contact url | int unsigned | YES | | NULL | | -| blocked | Contact is completely blocked for this user | boolean | YES | | NULL | | -| ignored | Posts from this contact are ignored | boolean | YES | | NULL | | -| collapsed | Posts from this contact are collapsed | boolean | YES | | NULL | | -| hidden | This contact is hidden from the others | boolean | YES | | NULL | | -| is-blocked | User is blocked by this contact | boolean | YES | | NULL | | -| pending | | boolean | YES | | NULL | | -| rel | The kind of the relation between the user and the contact | tinyint unsigned | YES | | NULL | | -| info | | mediumtext | YES | | NULL | | -| notify_new_posts | | boolean | YES | | NULL | | -| remote_self | | boolean | YES | | NULL | | -| fetch_further_information | | tinyint unsigned | YES | | NULL | | -| ffi_keyword_denylist | | text | YES | | NULL | | -| subhub | | boolean | YES | | NULL | | -| hub-verify | | varbinary(383) | YES | | NULL | | -| protocol | Protocol of the contact | char(4) | YES | | NULL | | -| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | | -| priority | Feed poll priority | tinyint unsigned | YES | | NULL | | +| Field | Description | Type | Null | Key | Default | Extra | +| ------------------------- | ----------------------------------------------------------------------- | ------------------ | ---- | --- | ------- | ----- | +| cid | Contact id of the linked public contact | int unsigned | NO | PRI | 0 | | +| uid | User id | mediumint unsigned | NO | PRI | 0 | | +| uri-id | Id of the item-uri table entry that contains the contact url | int unsigned | YES | | NULL | | +| blocked | Contact is completely blocked for this user | boolean | YES | | NULL | | +| ignored | Posts from this contact are ignored | boolean | YES | | NULL | | +| collapsed | Posts from this contact are collapsed | boolean | YES | | NULL | | +| hidden | This contact is hidden from the others | boolean | YES | | NULL | | +| is-blocked | User is blocked by this contact | boolean | YES | | NULL | | +| pending | | boolean | YES | | NULL | | +| rel | The kind of the relation between the user and the contact | tinyint unsigned | YES | | NULL | | +| info | | mediumtext | YES | | NULL | | +| notify_new_posts | | boolean | YES | | NULL | | +| remote_self | 0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare | tinyint unsigned | YES | | NULL | | +| fetch_further_information | 0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both | tinyint unsigned | YES | | NULL | | +| ffi_keyword_denylist | | text | YES | | NULL | | +| subhub | | boolean | YES | | NULL | | +| hub-verify | | varbinary(383) | YES | | NULL | | +| protocol | Protocol of the contact | char(4) | YES | | NULL | | +| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | | +| priority | Feed poll priority | tinyint unsigned | YES | | NULL | | Indexes ------------ From 735835193d577285ced8396df333dc0a2013c335 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 14 Aug 2023 17:17:25 -0400 Subject: [PATCH 2/3] Add a Message-ID header if none is set in Util\Emailer - Address anti-spam detection rule --- src/Util/Emailer.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Util/Emailer.php b/src/Util/Emailer.php index 5e4d98d4c..1accc574c 100644 --- a/src/Util/Emailer.php +++ b/src/Util/Emailer.php @@ -126,7 +126,7 @@ class Emailer * @return bool * @throws InternalServerErrorException */ - public function send(IEmail $email) + public function send(IEmail $email): bool { Hook::callAll('emailer_send_prepare', $email); @@ -151,7 +151,7 @@ class Emailer } $fromName = Email::encodeHeader(html_entity_decode($email->getFromName(), ENT_QUOTES, 'UTF-8'), 'UTF-8'); - $fromAddress = $email->getFromAddress(); + $fromAddress = $email->getFromAddress(); $replyTo = $email->getReplyTo(); $messageSubject = Email::encodeHeader(html_entity_decode($email->getSubject(), ENT_QUOTES, 'UTF-8'), 'UTF-8'); @@ -161,12 +161,17 @@ class Emailer . rand(100000000, 999999999) . '=:' . rand(10000, 99999); + $messageHeader = $email->getAdditionalMailHeaderString(); + if ($countMessageId === 0) { + $messageHeader .= 'Message-ID: baseUrl->getHost() . '>' . "\r\n"; + } + // generate a multipart/alternative message header - $messageHeader = $email->getAdditionalMailHeaderString() . - "From: $fromName <{$fromAddress}>\r\n" . - "Reply-To: $fromName <{$replyTo}>\r\n" . - "MIME-Version: 1.0\r\n" . - "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\""; + $messageHeader .= + "From: $fromName <{$fromAddress}>\r\n" . + "Reply-To: $fromName <{$replyTo}>\r\n" . + "MIME-Version: 1.0\r\n" . + "Content-Type: multipart/alternative; boundary=\"{$mimeBoundary}\""; // assemble the final multipart message body with the text and html types included $textBody = chunk_split(base64_encode($email->getMessage(true))); From 7faba0de5e3dad58c0782c6331cf88f874862197 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 15 Aug 2023 02:13:50 +0000 Subject: [PATCH 3/3] New function for the number of retrials / Daily reload of hooks --- src/Core/Worker.php | 11 +++++++++++ src/Worker/Cron.php | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/Core/Worker.php b/src/Core/Worker.php index 00885f692..7075b4b23 100644 --- a/src/Core/Worker.php +++ b/src/Core/Worker.php @@ -1365,6 +1365,17 @@ class Worker return $new_retrial; } + /** + * Get the number of retrials for the current worker task + * + * @return integer + */ + public static function getRetrial(): int + { + $queue = DI::app()->getQueue(); + return $queue['retrial'] ?? 0; + } + /** * Defers the current worker entry * diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 73d158070..18ede945c 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -21,6 +21,7 @@ namespace Friendica\Worker; +use Friendica\Core\Addon; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Worker; @@ -146,6 +147,8 @@ class Cron // Update "blocked" status of servers Worker::add(Worker::PRIORITY_LOW, 'UpdateBlockedServers'); + Addon::reload(); + DI::keyValue()->set('last_cron_daily', time()); }