From ab3d0b9926f469540ac3d414b953a595aa5fec3e Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Tue, 1 Nov 2005 08:47:03 +0100 Subject: [PATCH] store last feed update error in the database (SCHEMA UPDATED), display warning box in preferences on feed update error --- backend.php | 21 +++++++++++++++++++++ functions.php | 10 +++++++++- schema/ttrss_schema_mysql.sql | 3 ++- schema/ttrss_schema_pgsql.sql | 3 ++- tt-rss.css | 15 +++++++++++++++ tt-rss_compact.css | 15 +++++++++++++++ 6 files changed, 64 insertions(+), 3 deletions(-) diff --git a/backend.php b/backend.php index 8b8a90709..611b67b38 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 5057d23c4..2fdd13220 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 7abccc305..26ace74c2 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 bb971d2dd..cc9cec5dc 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 dd55bbc70..46654b850 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 29bf8e3d5..deec0e39e 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; +} +