]> git.wh0rd.org Git - tt-rss.git/commitdiff
actually implement manual purge RPC call
authorAndrew Dolgov <fox@bah.spb.su>
Thu, 18 Oct 2007 10:58:44 +0000 (11:58 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Thu, 18 Oct 2007 10:58:44 +0000 (11:58 +0100)
modules/backend-rpc.php

index b54bd783a653bd4afeb6f8907ff07dd19c8a8b43..5a8452ea4e88120fd2f4364042c758c5cbf8650c 100644 (file)
                        return;
                }
 
+               if ($subop == "purge") {
+                       $ids = split(",", db_escape_string($_GET["ids"]));
+                       $days = sprintf("%d", $_GET["days"]);
+
+                       print "<rpc-reply>";
+
+                       print "<message><![CDATA[";
+
+                       foreach ($ids as $id) {
+
+                               $result = db_query($link, "SELECT id FROM ttrss_feeds WHERE
+                                       id = '$id' AND owner_uid = ".$_SESSION["uid"]);
+
+                               if (db_num_rows($result) == 1) {
+                                       purge_feed($link, $id, $days, true);
+                               }
+                       }
+
+                       print "]]></message>";
+
+                       print "</rpc-reply>";
+
+                       return;
+               }
+
                print "<rpc-reply><error>Unknown method: $subop</error></rpc-reply>";
        }
 ?>