From 2c511b8a2388f5633456963f7b3c75b0070866b5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 15 May 2022 21:15:31 +0000 Subject: [PATCH] Check the edit date before storing history --- src/Model/Post/History.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Model/Post/History.php b/src/Model/Post/History.php index 68f2e9cda6..24ee7c1e7d 100644 --- a/src/Model/Post/History.php +++ b/src/Model/Post/History.php @@ -42,6 +42,12 @@ class History $post = Post::selectFirstPost($fields, ['uri-id' => $uri_id]); if (empty($post)) { + Logger::warning('Post not found', ['uri-id' => $uri_id]); + return; + } + + if ($item['edited'] <= $post['edited']) { + Logger::info('New edit date is not newer than the old one', ['uri-id' => $uri_id, 'old' => $post['edited'], 'new' => $item['edited']]); return; } -- 2.39.5