From c1d1b189f7356aa221f4b9d7138e34ba5de51b17 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 2 Dec 2020 08:36:23 +0000 Subject: [PATCH] Cleaned code --- src/Model/Post/Delayed.php | 4 +--- src/Protocol/Feed.php | 11 ++--------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/Model/Post/Delayed.php b/src/Model/Post/Delayed.php index 87e5fe8235..bfab406282 100644 --- a/src/Model/Post/Delayed.php +++ b/src/Model/Post/Delayed.php @@ -91,10 +91,8 @@ class Delayed Logger::notice('Post stored', ['id' => $id, 'uid' => $item['uid'], 'cid' => $item['contact-id']]); - // It should always contain an URI since this is needed to create a delayed post entry if (!empty($item['uri']) && self::exists($item['uri'], $item['uid'])) { - $result = self::delete($item['uri'], $item['uid']); - Logger::notice('Delayed post entry deleted', ['result' => $result, 'uri' => $item['uri']]); + self::delete($item['uri'], $item['uid']); } if (!empty($id) && (!empty($taglist) || !empty($attachments))) { diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index c5234c8cd4..fa568b4c3c 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -623,7 +623,7 @@ class Feed 'taglist' => $taglist, 'attachments' => $attachments]; } } else { - Logger::info('Post already crated or exists in the delayed posts queue', ['uri' => $item["uri"]]); + Logger::info('Post already crated or exists in the delayed posts queue', ['uid' => $item['uid'], 'uri' => $item["uri"]]); } } @@ -634,7 +634,7 @@ class Feed // Posts shouldn't be delayed more than a day $interval = min(1440, self::getPollInterval($contact)); $delay = max(round(($interval * 60) / $total), 60 * $min_posting); - Logger::notice('Got posting delay', ['delay' => $delay, 'interval' => $interval, 'items' => $total, 'cid' => $contact['id'], 'url' => $contact['url']]); + Logger::info('Got posting delay', ['delay' => $delay, 'interval' => $interval, 'items' => $total, 'cid' => $contact['id'], 'url' => $contact['url']]); } else { $delay = 0; } @@ -644,7 +644,6 @@ class Feed foreach ($postings as $posting) { if ($delay > 0) { $publish_time = time() + $post_delay; - Logger::notice('Got publishing date', ['delay' => $delay, 'cid' => $contact['id'], 'url' => $contact['url']]); $post_delay += $delay; } else { $publish_time = time(); @@ -653,12 +652,6 @@ class Feed $last_publish = DI::pConfig()->get($posting['item']['uid'], 'system', 'last_publish', 0, true); $next_publish = max($last_publish + (60 * $min_posting), time()); if ($publish_time < $next_publish) { - Logger::notice('Adapting publish time', - ['last' => date(DateTimeFormat::MYSQL, $last_publish), - 'next' => date(DateTimeFormat::MYSQL, $next_publish), - 'publish' => date(DateTimeFormat::MYSQL, $publish_time), - 'uid' => $posting['item']['uid'], 'cid' => $posting['item']['contact-id'], - 'uri' => $posting['item']["uri"]]); $publish_time = $next_publish; } $publish_at = date(DateTimeFormat::MYSQL, $publish_time);