From: Andrew Dolgov Date: Mon, 8 Apr 2013 09:58:48 +0000 (+0400) Subject: do not rely on feed_id when adding archived feed while unsubscribing X-Git-Tag: 1.7.9~40 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=b1df14d0eca3afa1f24a5202f47a6acc9400fe54;p=tt-rss.git do not rely on feed_id when adding archived feed while unsubscribing --- diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 68535562..469ca111 100644 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -1712,12 +1712,15 @@ class Pref_Feeds extends Handler_Protected { WHERE feed_url = '$feed_url' AND owner_uid = $owner_uid"); if (db_num_rows($result) == 0) { + $result = db_query($link, "SELECT MAX(id) AS id FROM ttrss_archived_feeds"); + $new_feed_id = (int)db_fetch_result($result, 0, "id") + 1; + 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 + SELECT $new_feed_id, owner_uid, title, feed_url, site_url from ttrss_feeds WHERE id = '$id'"); - $archive_id = $id; + $archive_id = $new_feed_id; } else { $archive_id = db_fetch_result($result, 0, "id"); }