Check the edit date before storing history

This commit is contained in:
Michael 2022-05-15 21:15:31 +00:00
parent d77b043d9c
commit 2c511b8a23

View File

@ -42,6 +42,12 @@ class History
$post = Post::selectFirstPost($fields, ['uri-id' => $uri_id]); $post = Post::selectFirstPost($fields, ['uri-id' => $uri_id]);
if (empty($post)) { 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; return;
} }