switch ($field_raw) {
case 0:
$field = "marked";
+ $additional_fields = ",last_marked = NOW()";
break;
case 1:
$field = "published";
+ $additional_fields = ",last_published = NOW()";
break;
case 2:
$field = "unread";
+ $additional_fields = ",last_read = NOW()";
break;
case 3:
$field = "note";
$article_ids = join(", ", $article_ids);
- if ($field == "unread") {
- $result = db_query($this->link, "UPDATE ttrss_user_entries SET $field = $set_to,
- last_read = NOW()
- WHERE ref_id IN ($article_ids) AND owner_uid = " . $_SESSION["uid"]);
- } else {
- $result = db_query($this->link, "UPDATE ttrss_user_entries SET $field = $set_to
- WHERE ref_id IN ($article_ids) AND owner_uid = " . $_SESSION["uid"]);
- }
+ $result = db_query($this->link, "UPDATE ttrss_user_entries SET $field = $set_to $additional_fields WHERE ref_id IN ($article_ids) AND owner_uid = " . $_SESSION["uid"]);
$num_updated = db_affected_rows($this->link, $result);
}
}
+ if ($num_updated > 0 && $field == "published") {
+ if (PUBSUBHUBBUB_HUB) {
+ $rss_link = get_self_url_prefix() .
+ "/public.php?op=rss&id=-2&key=" .
+ get_feed_access_key($this->link, -2, false);
+
+ $p = new Publisher(PUBSUBHUBBUB_HUB);
+ $pubsub_result = $p->publish_update($rss_link);
+ }
+ }
+
print $this->wrap(self::STATUS_OK, array("status" => "OK",
"updated" => $num_updated));
$mark = "false";
}
- $result = db_query($this->link, "UPDATE ttrss_user_entries SET marked = $mark
+ $result = db_query($this->link, "UPDATE ttrss_user_entries SET marked = $mark,
+ last_marked = NOW()
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
print json_encode(array("message" => "UPDATE_COUNTERS"));
}
$result = db_query($this->link, "UPDATE ttrss_user_entries SET
- published = $pub, last_read = NOW()
+ published = $pub, last_published = NOW()
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
$pubsub_result = false;
if ($cmode == 0) {
db_query($link, "UPDATE ttrss_user_entries SET
- marked = false,last_read = NOW()
+ marked = false, last_marked = NOW()
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
} else if ($cmode == 1) {
db_query($link, "UPDATE ttrss_user_entries SET
- marked = true
+ marked = true, last_marked = NOW()
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
} else {
db_query($link, "UPDATE ttrss_user_entries SET
- marked = NOT marked,last_read = NOW()
+ marked = NOT marked,last_marked = NOW()
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
}
}
if ($cmode == 0) {
db_query($link, "UPDATE ttrss_user_entries SET
- published = false,last_read = NOW()
+ published = false,last_published = NOW()
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
} else if ($cmode == 1) {
db_query($link, "UPDATE ttrss_user_entries SET
- published = true,last_read = NOW()
+ published = true,last_published = NOW()
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
} else {
db_query($link, "UPDATE ttrss_user_entries SET
- published = NOT published,last_read = NOW()
+ published = NOT published,last_published = NOW()
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
}
<?php
define('EXPECTED_CONFIG_VERSION', 26);
- define('SCHEMA_VERSION', 104);
+ define('SCHEMA_VERSION', 105);
$fetch_last_error = false;
$pluginhost = false;
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
$allow_archived = true;
+ if (!$override_order) $override_order = "last_marked DESC, updated DESC";
+
} else if ($feed == -2) { // published virtual feed OR labels category
if (!$cat_view) {
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
$allow_archived = true;
- if (!$override_order) $override_order = "last_read DESC, updated DESC";
+ if (!$override_order) $override_order = "last_published DESC, updated DESC";
} else {
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
comments,
int_id,
unread,feed_id,marked,published,link,last_read,orig_feed_id,
+ last_marked, last_published,
".SUBSTRING_FOR_DATE."(last_read,1,19) as last_read_noms,
$vfeed_query_part
$content_query_part
"label_cache," .
"link," .
"last_read," .
+ "last_marked, last_published, " .
SUBSTRING_FOR_DATE . "(last_read,1,19) as last_read_noms," .
$since_id_part .
$vfeed_query_part .
}
}
+ $last_marked = ($marked == 'true') ? 'NOW()' : 'NULL';
+ $last_published = ($published == 'true') ? 'NOW()' : 'NULL';
+
$result = db_query($link,
"INSERT INTO ttrss_user_entries
(ref_id, owner_uid, feed_id, unread, last_read, marked,
- published, score, tag_cache, label_cache, uuid)
+ published, score, tag_cache, label_cache, uuid,
+ last_marked, last_published)
VALUES ('$ref_id', '$owner_uid', '$feed', $unread,
- $last_read_qpart, $marked, $published, '$score', '', '', '')");
+ $last_read_qpart, $marked, $published, '$score', '', '',
+ '', $last_marked, $last_published)");
if (PUBSUBHUBBUB_HUB && $published == 'true') {
$rss_link = get_self_url_prefix() .
last_read datetime,
score int not null default 0,
note longtext,
+ last_marked datetime,
+ last_published datetime,
unread bool not null default 1,
index (ref_id),
foreign key (ref_id) references ttrss_entries(id) ON DELETE CASCADE,
create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
-insert into ttrss_version values (104);
+insert into ttrss_version values (105);
create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null,
label_cache text not null,
last_read timestamp,
score int not null default 0,
+ last_marked timestamp,
+ last_published timestamp,
note text,
unread boolean not null default true);
create table ttrss_version (schema_version int not null);
-insert into ttrss_version values (104);
+insert into ttrss_version values (105);
create table ttrss_enclosures (id serial not null primary key,
content_url text not null,
--- /dev/null
+begin;
+
+alter table ttrss_user_entries add column last_marked datetime;
+alter table ttrss_user_entries add column last_published datetime;
+
+update ttrss_user_entries set last_published = last_read where published = true;
+update ttrss_user_entries set last_marked = last_read where marked = true;
+
+update ttrss_version set schema_version = 105;
+
+commit;
--- /dev/null
+begin;
+
+alter table ttrss_user_entries add column last_marked timestamp;
+alter table ttrss_user_entries add column last_published timestamp;
+
+update ttrss_user_entries set last_published = last_read where published = true;
+update ttrss_user_entries set last_marked = last_read where marked = true;
+
+update ttrss_version set schema_version = 105;
+
+commit;