create_published_article: set last_published properly on creation

This commit is contained in:
Andrew Dolgov 2013-03-25 10:30:01 +04:00
parent f50c2785a7
commit d2888e8832
1 changed files with 8 additions and 5 deletions

View File

@ -122,14 +122,16 @@ class Article extends Handler_Protected {
db_query($link, "UPDATE ttrss_entries SET db_query($link, "UPDATE ttrss_entries SET
content = '$content', content_hash = '$content_hash' WHERE id = '$ref_id'"); content = '$content', content_hash = '$content_hash' WHERE id = '$ref_id'");
db_query($link, "UPDATE ttrss_user_entries SET published = true WHERE db_query($link, "UPDATE ttrss_user_entries SET published = true,
last_published = NOW() WHERE
int_id = '$int_id' AND owner_uid = '$owner_uid'"); int_id = '$int_id' AND owner_uid = '$owner_uid'");
} else { } else {
db_query($link, "INSERT INTO ttrss_user_entries db_query($link, "INSERT INTO ttrss_user_entries
(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache, last_read, note, unread) (ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,
last_read, note, unread, last_published)
VALUES VALUES
('$ref_id', '', NULL, NULL, $owner_uid, true, '', '', NOW(), '', false)"); ('$ref_id', '', NULL, NULL, $owner_uid, true, '', '', NOW(), '', false, NOW())");
} }
if (count($labels) != 0) { if (count($labels) != 0) {
@ -152,9 +154,10 @@ class Article extends Handler_Protected {
$ref_id = db_fetch_result($result, 0, "id"); $ref_id = db_fetch_result($result, 0, "id");
db_query($link, "INSERT INTO ttrss_user_entries db_query($link, "INSERT INTO ttrss_user_entries
(ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache, last_read, note, unread) (ref_id, uuid, feed_id, orig_feed_id, owner_uid, published, tag_cache, label_cache,
last_read, note, unread, last_published)
VALUES VALUES
('$ref_id', '', NULL, NULL, $owner_uid, true, '', '', NOW(), '', false)"); ('$ref_id', '', NULL, NULL, $owner_uid, true, '', '', NOW(), '', false, NOW())");
if (count($labels) != 0) { if (count($labels) != 0) {
foreach ($labels as $label) { foreach ($labels as $label) {