X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPost%2FHistory.php;h=24ee7c1e7d13bea850e12b6f91d07a04cd21eb95;hb=2c511b8a2388f5633456963f7b3c75b0070866b5;hp=e889ccf20559b0344e308fb22646ee26cb3de59e;hpb=324cce7a19a61ed3d305c508ad233ee0ab29323d;p=friendica.git diff --git a/src/Model/Post/History.php b/src/Model/Post/History.php index e889ccf205..24ee7c1e7d 100644 --- a/src/Model/Post/History.php +++ b/src/Model/Post/History.php @@ -38,14 +38,20 @@ class History public static function add(int $uri_id, array $item) { $allfields = DBStructure::definition('', false); - $fields = array_keys($allfields['post-history']['fields']); + $fields = array_keys($allfields['post-history']['fields']); $post = Post::selectFirstPost($fields, ['uri-id' => $uri_id]); if (empty($post)) { + Logger::warning('Post not found', ['uri-id' => $uri_id]); return; } - $update = false; + 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; + } + + $update = false; $changed = DBStructure::getFieldsForTable('post-history', $item); unset($changed['uri-id']); unset($changed['edited']);