1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-30 16:17:10 +00:00

split some more functions from functions.php

This commit is contained in:
Andrew Dolgov
2013-01-22 22:32:17 +04:00
parent 04f60eb729
commit 87d7e8507a
8 changed files with 666 additions and 655 deletions

View File

@@ -1070,7 +1070,7 @@ class Pref_Feeds extends Handler_Protected {
function clear() {
$id = db_escape_string($_REQUEST["id"]);
clear_feed_articles($this->link, $id);
$this->clear_feed_articles($this->link, $id);
}
function rescore() {
@@ -1677,5 +1677,29 @@ class Pref_Feeds extends Handler_Protected {
print "</div>";
}
/**
* Purge a feed contents, marked articles excepted.
*
* @param mixed $link The database connection.
* @param integer $id The id of the feed to purge.
* @return void
*/
private function clear_feed_articles($link, $id) {
if ($id != 0) {
$result = db_query($link, "DELETE FROM ttrss_user_entries
WHERE feed_id = '$id' AND marked = false AND owner_uid = " . $_SESSION["uid"]);
} else {
$result = db_query($link, "DELETE FROM ttrss_user_entries
WHERE feed_id IS NULL AND marked = false AND owner_uid = " . $_SESSION["uid"]);
}
$result = db_query($link, "DELETE FROM ttrss_entries WHERE
(SELECT COUNT(int_id) FROM ttrss_user_entries WHERE ref_id = id) = 0");
ccache_update($link, $id, $_SESSION['uid']);
} // function clear_feed_articles
}
?>