diff --git a/ChangeLog b/ChangeLog index f3c88d1..bf5230f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ Version 1.2.0 (unreleased) * Always update feed URL to avoid useless redirections for futures requests * Add support for Wallabag service * Show last parsing error message in user interface +* Disable automatically a feed after too many failures * Add unit tests Migration procedure from 1.1.x to 1.2.0: diff --git a/app/constants.php b/app/constants.php index f3c7347..bbeae31 100644 --- a/app/constants.php +++ b/app/constants.php @@ -33,6 +33,7 @@ defined('PROXY_USERNAME') or define('PROXY_USERNAME', ''); defined('PROXY_PASSWORD') or define('PROXY_PASSWORD', ''); defined('SUBSCRIPTION_CONCURRENT_REQUESTS') or define('SUBSCRIPTION_CONCURRENT_REQUESTS', 5); +defined('SUBSCRIPTION_DISABLE_THRESHOLD_ERROR') or define('SUBSCRIPTION_DISABLE_THRESHOLD_ERROR', 10); defined('RULES_DIRECTORY') or define('RULES_DIRECTORY', ROOT_DIRECTORY.DIRECTORY_SEPARATOR.'rules'); diff --git a/app/handlers/feed.php b/app/handlers/feed.php index b004019..c0f6897 100644 --- a/app/handlers/feed.php +++ b/app/handlers/feed.php @@ -104,10 +104,12 @@ function update_feed($user_id, $feed_id) ); if (! empty($error_message)) { + $error_count = $subscription['parsing_error'] + 1; Model\Feed\update_feed($user_id, $feed_id, array( 'last_checked' => time(), - 'parsing_error' => 1, + 'parsing_error' => $error_count, 'parsing_error_message' => $error_message, + 'enabled' => $error_count > SUBSCRIPTION_DISABLE_THRESHOLD_ERROR ? 0 : 1, )); return false; diff --git a/app/schemas/postgres.php b/app/schemas/postgres.php index 3f57b06..f342f13 100644 --- a/app/schemas/postgres.php +++ b/app/schemas/postgres.php @@ -47,7 +47,7 @@ function version_1(PDO $pdo) etag VARCHAR(255), enabled BOOLEAN DEFAULT TRUE, download_content BOOLEAN DEFAULT FALSE, - parsing_error BOOLEAN DEFAULT FALSE, + parsing_error INTEGER DEFAULT 0, rtl BOOLEAN DEFAULT FALSE, cloak_referrer BOOLEAN DEFAULT FALSE, FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE, diff --git a/app/templates/feed_items.php b/app/templates/feed_items.php index 05a940c..859043a 100644 --- a/app/templates/feed_items.php +++ b/app/templates/feed_items.php @@ -22,7 +22,7 @@ - + 0): ?>
diff --git a/app/templates/feeds.php b/app/templates/feeds.php index 52b7b32..0d52be4 100644 --- a/app/templates/feeds.php +++ b/app/templates/feeds.php @@ -23,7 +23,7 @@