diff options
| author | 2024-10-14 09:34:16 +0200 | |
|---|---|---|
| committer | 2024-10-14 09:34:16 +0200 | |
| commit | 256dcc21bb222184d5e917ea57cec334b74b96f4 (patch) | |
| tree | 89455b225b6fb2f00b98cead6d5450282c4cc6ce /app/Controllers | |
| parent | 40c4d798f0decf2d49005277c6d3a3d0e39bedfd (diff) | |
New unicity policies for feeds with bad GUIDs (#4487)
New set of unicity criteria options.
New tolerance heuristic:
> `$invalidGuidsTolerance` (default 0.05) The maximum ratio (rounded) of invalid GUIDs to tolerate before degrading the unicity criteria.
> Example for 0.05 (5% rounded): tolerate 0 invalid GUIDs for up to 9 articles, 1 for 10, 2 for 30, 3 for 50, 4 for 70, 5 for 90, 6 for 110, etc.
> The default value of 5% rounded was chosen to allow 1 invalid GUID for feeds of 10 articles, which is a frequently observed amount of articles.
Diffstat (limited to 'app/Controllers')
| -rwxr-xr-x | app/Controllers/feedController.php | 3 | ||||
| -rw-r--r-- | app/Controllers/subscriptionController.php | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 2b757177c..26e3caa3c 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -716,7 +716,8 @@ class FreshRSS_feed_Controller extends FreshRSS_ActionController { } } } - if (!empty($feedProperties)) { + if (!empty($feedProperties) || $feedIsNew) { + $feedProperties['attributes'] = $feed->attributes(); $ok = $feedDAO->updateFeed($feed->id(), $feedProperties); if (!$ok && $feedIsNew) { //Cancel adding new feed in case of database error at first actualize diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 683f403bc..43f6aad11 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -108,6 +108,18 @@ class FreshRSS_subscription_Controller extends FreshRSS_ActionController { FreshRSS_View::prependTitle($feed->name() . ' · ' . _t('sub.title.feed_management') . ' · '); if (Minz_Request::isPost()) { + $unicityCriteria = Minz_Request::paramString('unicityCriteria'); + if (in_array($unicityCriteria, ['id', '', null], strict: true)) { + $unicityCriteria = null; + } + if ($unicityCriteria === null && $feed->attributeBoolean('hasBadGuids')) { // Legacy + $unicityCriteria = 'link'; + } + $feed->_attribute('hasBadGuids', null); // Remove legacy + $feed->_attribute('unicityCriteria', $unicityCriteria); + + $feed->_attribute('unicityCriteriaForced', Minz_Request::paramBoolean('unicityCriteriaForced') ? true : null); + $user = Minz_Request::paramString('http_user_feed' . $id); $pass = Minz_Request::paramString('http_pass_feed' . $id); |
