summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-11-01 08:47:03 +0100
committerAndrew Dolgov <[email protected]>2005-11-01 08:47:03 +0100
commitab3d0b9926f469540ac3d414b953a595aa5fec3e (patch)
tree92803a123309cc346219c01d2f6f3af6ae54d455
parentf5a50b25d6d023050ee7d8524bee1bdf7030057b (diff)
store last feed update error in the database (SCHEMA UPDATED), display warning box in preferences on feed update error
-rw-r--r--backend.php21
-rw-r--r--functions.php10
-rw-r--r--schema/ttrss_schema_mysql.sql3
-rw-r--r--schema/ttrss_schema_pgsql.sql3
-rw-r--r--tt-rss.css15
-rw-r--r--tt-rss_compact.css15
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 "<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\">
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;
+}
+