]> git.mxchange.org Git - friendica.git/blobdiff - src/Protocol/Feed.php
Delay unprepared posts
[friendica.git] / src / Protocol / Feed.php
index c5234c8cd4f4342d4dbfc8ca89aaa6e9055a632d..f674f7081512d252d19bbadfc9011745df91e838 100644 (file)
@@ -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 created 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,18 +652,11 @@ 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);
 
-                               Post\Delayed::add($publish_at, $posting['item'], $posting['notify'], $posting['taglist'], $posting['attachments']);
-                               DI::pConfig()->set($item['uid'], 'system', 'last_publish', $next_publish);
+                               Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], false, $publish_at, $posting['taglist'], $posting['attachments']);
                        }
                }