A free, self-hostable news aggregator…
Fetch feed name / website / description if empty (#3071)
Alexandre Alapetiteb9d2e6457a30
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.phpindex 81c54f161..fda6ddfcd 100755--- a/app/Controllers/feedController.php+++ b/app/Controllers/feedController.php@@ -430,6 +430,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController {$entryDAO->commit();}+ $feedProperties = [];+if ($pubsubhubbubEnabledGeneral && $feed->hubUrl() && $feed->selfUrl()) { //selfUrl has priority for WebSubif ($feed->selfUrl() !== $url) { // https://github.com/pubsubhubbub/PubSubHubbub/wiki/Moving-Feeds-or-changing-Hubs$selfUrl = checkUrl($feed->selfUrl());@@ -445,7 +447,28 @@ class FreshRSS_feed_Controller extends Minz_ActionController {}} elseif ($feed->url() !== $url) { // HTTP 301 Moved PermanentlyMinz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url(false));- $feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));+ $feedProperties['url'] = $feed->url();+ }++ if ($simplePie != null) {+ if (trim($feed->name()) == '') {+ //HTML to HTML-PRE //ENT_COMPAT except '&'+ $name = strtr(html_only_entity_decode($simplePie->get_title()), array('<' => '<', '>' => '>', '"' => '"'));+ $feedProperties['name'] = $name == '' ? $feed->url() : $name;+ }+ if (trim($feed->website()) == '') {+ $website = html_only_entity_decode($simplePie->get_link());+ $feedProperties['website'] = $website == '' ? $feed->url() : $website;+ }+ if (trim($feed->description()) == '') {+ $description = html_only_entity_decode($simplePie->get_description());+ if ($description != '') {+ $feedProperties['description'] = $description;+ }+ }+ }+ if (!empty($feedProperties)) {+ $feedDAO->updateFeed($feed->id(), $feedProperties);}$feed->faviconPrepare();