]> git.wh0rd.org Git - tt-rss.git/commitdiff
fixed serious bug in MySQL schema (cascade deletes were unfunctional), add yet anothe...
authorAndrew Dolgov <fox@bah.spb.su>
Wed, 12 Oct 2005 10:54:09 +0000 (11:54 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Wed, 12 Oct 2005 10:54:09 +0000 (11:54 +0100)
functions.php
schema/ttrss_schema_mysql.sql

index 80cd61913343d85cc515cf8e2f7d30b0d30f9a16..0c0fc047febbd057bf73cf950328d81e8ba3cbce 100644 (file)
@@ -27,9 +27,9 @@
                $result = db_query($link, "SELECT feed_url,id,last_updated FROM ttrss_feeds");
 
                while ($line = db_fetch_assoc($result)) {
-                       if (!$line["last_updated"] || time() - strtotime($line["last_updated"]) > 1800) {
+//                     if (!$line["last_updated"] || time() - strtotime($line["last_updated"]) > 1800) {
                                update_rss_feed($link, $line["feed_url"], $line["id"]);
-                       }
+//                     }
                }
 
                purge_old_posts($link);
                                if (!$entry_title) continue;
                                if (!$entry_link) continue;
 
-                               $entry_content = $item["description"];
-                               if (!$entry_content) $entry_content = $item["content:escaped"];
+                               $entry_content = $item["content:escaped"];
+
+                               if (!$entry_content) $entry_content = $item["content:encoded"];
                                if (!$entry_content) $entry_content = $item["content"];
+                               if (!$entry_content) $entry_content = $item["description"];
 
 //                             if (!$entry_content) continue;
 
                                // WTF
                                if (is_array($entry_content)) {
                                        $entry_content = $entry_content["encoded"];
+                                       if (!$entry_content) $entry_content = $entry_content["escaped"];
                                }
 
+//                             print_r($item);
+//                             print_r($entry_content);
+
                                $content_hash = "SHA1:" . sha1(strip_tags($entry_content));
 
                                $entry_comments = $item["comments"];
                                        WHERE
                                                guid = '$entry_guid'");
 
+//                             print db_num_rows($result) . "$entry_guid<br/>";
+
                                if (db_num_rows($result) == 0) {
 
                                        error_reporting(0);
index 3c563e1f6ecacbc879b635ddb60a8985b9f5f530..de01f20d611c8474c497e55df5e684d9ecc3f29d 100644 (file)
@@ -29,7 +29,7 @@ insert into ttrss_feeds (title,feed_url) values ('Technocrat.net',
        'http://syndication.technocrat.net/rss');
 
 create table ttrss_entries (id integer not null primary key auto_increment, 
-       feed_id integer not null references ttrss_feeds(id) ON DELETE CASCADE, 
+       feed_id integer not null,
        updated datetime not null, 
        title text not null, 
        guid varchar(255) not null unique, 
@@ -41,7 +41,9 @@ create table ttrss_entries (id integer not null primary key auto_increment,
        date_entered datetime not null,
        no_orig_date bool not null default 0,
        comments varchar(250) not null default '',
-       unread bool not null default 1) TYPE=InnoDB;
+       unread bool not null default 1,
+       index (feed_id),
+       foreign key (feed_id) references ttrss_feeds(id) ON DELETE CASCADE) TYPE=InnoDB;
 
 drop table if exists ttrss_filters;
 drop table if exists ttrss_filter_types;
@@ -72,5 +74,7 @@ insert into ttrss_labels (sql_exp,description) values ('unread = true',
 
 create table ttrss_tags (id integer primary key auto_increment, 
        tag_name varchar(250) not null,
-       post_id integer references ttrss_entries(id) ON DELETE CASCADE) TYPE=InnoDB;
+       post_id integer not null,
+       index (post_id),
+       foreign key (post_id) references ttrss_entries(id) ON DELETE CASCADE) TYPE=InnoDB;