From: Andrew Dolgov Date: Tue, 1 Nov 2005 07:47:03 +0000 (+0100) Subject: store last feed update error in the database (SCHEMA UPDATED), display warning box... X-Git-Tag: 1.0.7~13 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ab3d0b9926f469540ac3d414b953a595aa5fec3e;p=tt-rss.git store last feed update error in the database (SCHEMA UPDATED), display warning box in preferences on feed update error --- diff --git a/backend.php b/backend.php index 8b8a9070..611b67b3 100644 --- a/backend.php +++ b/backend.php @@ -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 "
"; + + print "Feeds with update errors:"; + + print ""; + print "
"; + + } + print "
diff --git a/functions.php b/functions.php index 5057d23c..2fdd1322 100644 --- a/functions.php +++ b/functions.php @@ -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"); diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index 7abccc30..26ace74c 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -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'); diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index bb971d2d..cc9cec5d 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -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'); diff --git a/tt-rss.css b/tt-rss.css index dd55bbc7..46654b85 100644 --- a/tt-rss.css +++ b/tt-rss.css @@ -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; +} + diff --git a/tt-rss_compact.css b/tt-rss_compact.css index 29bf8e3d..deec0e39 100644 --- a/tt-rss_compact.css +++ b/tt-rss_compact.css @@ -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; +} +