store last feed update error in the database (SCHEMA UPDATED), display warning box in preferences on feed update error

This commit is contained in:
Andrew Dolgov 2005-11-01 08:47:03 +01:00
parent f5a50b25d6
commit ab3d0b9926
6 changed files with 64 additions and 3 deletions

View File

@ -815,6 +815,27 @@
}
}
$result = db_query($link, "SELECT id,title,feed_url,last_error
FROM ttrss_feeds WHERE last_error != ''");
if (db_num_rows($result) > 0) {
print "<div class=\"warning\">";
print "<b>Feeds with update errors:</b>";
print "<ul class=\"nomarks\">";
while ($line = db_fetch_assoc($result)) {
print "<li>" . $line["title"] . " (" . $line["feed_url"] . "): " .
$line["last_error"];
}
print "</ul>";
print "</div>";
}
print "<table class=\"prefAddFeed\"><tr>
<td><input id=\"fadd_link\"></td>
<td colspan=\"4\" align=\"right\">

View File

@ -92,8 +92,11 @@
if (WEB_DEMO_MODE) return;
$feed = db_escape_string($feed);
error_reporting(0);
$rss = fetch_rss($feed_url);
error_reporting (E_ERROR | E_WARNING | E_PARSE);
db_query($link, "BEGIN");
@ -349,8 +352,13 @@
}
}
db_query($link, "UPDATE ttrss_feeds SET last_updated = NOW() WHERE id = '$feed'");
db_query($link, "UPDATE ttrss_feeds
SET last_updated = NOW(), last_error = '' WHERE id = '$feed'");
} else {
$error_msg = db_escape_string(magpie_error());
db_query($link,
"UPDATE ttrss_feeds SET last_error = '$error_msg' WHERE id = '$feed'");
}
db_query($link, "COMMIT");

View File

@ -7,7 +7,8 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
feed_url varchar(250) unique not null,
icon_url varchar(250) not null default '',
update_interval integer not null default 0,
last_updated datetime default '') TYPE=InnoDB;
last_updated datetime default '',
last_error text not null default '') TYPE=InnoDB;
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');
insert into ttrss_feeds (title,feed_url) values ('Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml');

View File

@ -7,7 +7,8 @@ create table ttrss_feeds (id serial not null primary key,
feed_url varchar(250) unique not null,
icon_url varchar(250) not null default '',
update_interval integer not null default 0,
last_updated timestamp default null);
last_updated timestamp default null,
last_error text not null default '');
insert into ttrss_feeds (title,feed_url) values ('Footnotes', 'http://gnomedesktop.org/node/feed');
insert into ttrss_feeds (title,feed_url) values ('Freedesktop.org', 'http://planet.freedesktop.org/rss20.xml');

View File

@ -443,3 +443,18 @@ input.prefsTabSelected {
input.prefsTab:hover {
background : white;
}
div.warning {
background : #fffff0;
border : 1px solid #c0c0c0;
padding : 5px;
margin : 5px;
font-size : x-small;
}
ul.nomarks {
list-style-type : none;
margin : 0px;
padding : 10px;
}

View File

@ -473,3 +473,18 @@ input.prefsTabSelected {
input.prefsTab:hover {
background : white;
}
div.warning {
background : #fffff0;
border : 1px solid #c0c0c0;
padding : 5px;
margin : 5px;
font-size : x-small;
}
ul.nomarks {
list-style-type : none;
margin : 0px;
padding : 10px;
}