From ec3eead034e18365466237f2db71ad959cd8b7e0 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 3 Aug 2021 05:39:04 +0000 Subject: [PATCH] Don't set the pconfig values on manual mode --- src/Model/Post/Delayed.php | 5 +---- src/Protocol/Feed.php | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Model/Post/Delayed.php b/src/Model/Post/Delayed.php index dd26869d1..669c365cd 100644 --- a/src/Model/Post/Delayed.php +++ b/src/Model/Post/Delayed.php @@ -58,8 +58,7 @@ class Delayed $last_publish = DI::pConfig()->get($item['uid'], 'system', 'last_publish', 0, true); $next_publish = max($last_publish + (60 * $min_posting), time()); $delayed = date(DateTimeFormat::MYSQL, $next_publish); - } else { - $next_publish = strtotime($delayed); + DI::pConfig()->set($item['uid'], 'system', 'last_publish', $next_publish); } Logger::notice('Adding post for delayed publishing', ['uid' => $item['uid'], 'delayed' => $delayed, 'uri' => $uri]); @@ -69,8 +68,6 @@ class Delayed return 0; } - DI::pConfig()->set($item['uid'], 'system', 'last_publish', $next_publish); - $delayed_post = [ 'uri' => $uri, 'uid' => $item['uid'], diff --git a/src/Protocol/Feed.php b/src/Protocol/Feed.php index a1b77f8bd..69ca1bfce 100644 --- a/src/Protocol/Feed.php +++ b/src/Protocol/Feed.php @@ -601,7 +601,9 @@ class Feed } $publish_at = date(DateTimeFormat::MYSQL, $publish_time); - Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], false, $publish_at, $posting['taglist'], $posting['attachments']); + if (Post\Delayed::add($posting['item']['uri'], $posting['item'], $posting['notify'], false, $publish_at, $posting['taglist'], $posting['attachments'])) { + DI::pConfig()->set($item['uid'], 'system', 'last_publish', $publish_time); + } } }