]> git.wh0rd.org Git - tt-rss.git/commitdiff
split remove_feed_* stuff to pref/feeds
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 22 Jan 2013 18:38:18 +0000 (22:38 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 22 Jan 2013 18:38:18 +0000 (22:38 +0400)
classes/pref/feeds.php
include/functions.php

index e9b09829de40cd1e21d8ee8b70621e9808576bea..31373c972ddda9647ad408cd96cfd0d28a486aaf 100644 (file)
@@ -1062,7 +1062,7 @@ class Pref_Feeds extends Handler_Protected {
                $ids = split(",", db_escape_string($_REQUEST["ids"]));
 
                foreach ($ids as $id) {
-                       remove_feed($this->link, $id, $_SESSION["uid"]);
+                       $this->remove_feed($this->link, $id, $_SESSION["uid"]);
                }
 
                return;
@@ -1208,7 +1208,7 @@ class Pref_Feeds extends Handler_Protected {
        function removeCat() {
                $ids = split(",", db_escape_string($_REQUEST["ids"]));
                foreach ($ids as $id) {
-                       remove_feed_category($this->link, $id, $_SESSION["uid"]);
+                       $this->remove_feed_category($this->link, $id, $_SESSION["uid"]);
                }
        }
 
@@ -1700,6 +1700,61 @@ class Pref_Feeds extends Handler_Protected {
                ccache_update($link, $id, $_SESSION['uid']);
        } // function clear_feed_articles
 
+       private function remove_feed_category($link, $id, $owner_uid) {
+
+               db_query($link, "DELETE FROM ttrss_feed_categories
+                       WHERE id = '$id' AND owner_uid = $owner_uid");
+
+               ccache_remove($link, $id, $owner_uid, true);
+       }
+
+       private function remove_feed($link, $id, $owner_uid) {
+
+               if ($id > 0) {
+
+                       /* save starred articles in Archived feed */
+
+                       db_query($link, "BEGIN");
+
+                       /* prepare feed if necessary */
+
+                       $result = db_query($link, "SELECT id FROM ttrss_archived_feeds
+                               WHERE id = '$id'");
+
+                       if (db_num_rows($result) == 0) {
+                               db_query($link, "INSERT INTO ttrss_archived_feeds
+                                       (id, owner_uid, title, feed_url, site_url)
+                               SELECT id, owner_uid, title, feed_url, site_url from ttrss_feeds
+                               WHERE id = '$id'");
+                       }
+
+                       db_query($link, "UPDATE ttrss_user_entries SET feed_id = NULL,
+                               orig_feed_id = '$id' WHERE feed_id = '$id' AND
+                                       marked = true AND owner_uid = $owner_uid");
+
+                       /* Remove access key for the feed */
+
+                       db_query($link, "DELETE FROM ttrss_access_keys WHERE
+                               feed_id = '$id' AND owner_uid = $owner_uid");
+
+                       /* remove the feed */
+
+                       db_query($link, "DELETE FROM ttrss_feeds
+                                       WHERE id = '$id' AND owner_uid = $owner_uid");
+
+                       db_query($link, "COMMIT");
+
+                       if (file_exists(ICONS_DIR . "/$id.ico")) {
+                               unlink(ICONS_DIR . "/$id.ico");
+                       }
+
+                       ccache_remove($link, $id, $owner_uid);
+
+               } else {
+                       label_remove($link, -11-$id, $owner_uid);
+                       ccache_remove($link, -11-$id, $owner_uid);
+               }
+       }
 
 }
 ?>
index 59a3e29cf445f1abb37e64c91d0d7d94769432a0..0ee058086cc0169238746d261e5a257bbac975e1 100644 (file)
                }
        }
 
-       function remove_feed($link, $id, $owner_uid) {
-
-               if ($id > 0) {
-
-                       /* save starred articles in Archived feed */
-
-                       db_query($link, "BEGIN");
-
-                       /* prepare feed if necessary */
-
-                       $result = db_query($link, "SELECT id FROM ttrss_archived_feeds
-                               WHERE id = '$id'");
-
-                       if (db_num_rows($result) == 0) {
-                               db_query($link, "INSERT INTO ttrss_archived_feeds
-                                       (id, owner_uid, title, feed_url, site_url)
-                               SELECT id, owner_uid, title, feed_url, site_url from ttrss_feeds
-                               WHERE id = '$id'");
-                       }
-
-                       db_query($link, "UPDATE ttrss_user_entries SET feed_id = NULL,
-                               orig_feed_id = '$id' WHERE feed_id = '$id' AND
-                                       marked = true AND owner_uid = $owner_uid");
-
-                       /* Remove access key for the feed */
-
-                       db_query($link, "DELETE FROM ttrss_access_keys WHERE
-                               feed_id = '$id' AND owner_uid = $owner_uid");
-
-                       /* remove the feed */
-
-                       db_query($link, "DELETE FROM ttrss_feeds
-                                       WHERE id = '$id' AND owner_uid = $owner_uid");
-
-                       db_query($link, "COMMIT");
-
-                       if (file_exists(ICONS_DIR . "/$id.ico")) {
-                               unlink(ICONS_DIR . "/$id.ico");
-                       }
-
-                       ccache_remove($link, $id, $owner_uid);
-
-               } else {
-                       label_remove($link, -11-$id, $owner_uid);
-                       ccache_remove($link, -11-$id, $owner_uid);
-               }
-       }
 
        function get_feed_category($link, $feed_cat, $parent_cat_id = false) {
                if ($parent_cat_id) {
                return false;
        }
 
-       function remove_feed_category($link, $id, $owner_uid) {
-
-               db_query($link, "DELETE FROM ttrss_feed_categories
-                       WHERE id = '$id' AND owner_uid = $owner_uid");
-
-               ccache_remove($link, $id, $owner_uid, true);
-       }
-
        function getArticleFeed($link, $id) {
                $result = db_query($link, "SELECT feed_id FROM ttrss_user_entries
                        WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);