]> git.wh0rd.org - tt-rss.git/commitdiff
Call the subscription hook from the plugins even if fetch_file_contents returned...
authorMatthieuS <sartmatt@gmail.com>
Wed, 23 May 2018 09:00:04 +0000 (09:00 +0000)
committerMatthieuS <sartmatt@gmail.com>
Wed, 23 May 2018 09:00:04 +0000 (09:00 +0000)
This allows a plug-in to override the fetch when the core fetch method fails for some feeds (eg. Tumblr feeds when requested from an EU IP).

classes/feeds.php

index 015418328729ccb3cc7849be80c99f399533e338..47a6b56b87973356161d5129ebeda4020efcbb41 100755 (executable)
@@ -1466,6 +1466,10 @@ class Feeds extends Handler_Protected {
 
                $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass);
 
+               foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) {
+                       $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass);
+               }
+               
                if (!$contents) {
                        if (preg_match("/cloudflare\.com/", $fetch_last_error_content)) {
                                $fetch_last_error .= " (feed behind Cloudflare)";
@@ -1474,10 +1478,6 @@ class Feeds extends Handler_Protected {
                        return array("code" => 5, "message" => $fetch_last_error);
                }
 
-               foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_SUBSCRIBE_FEED) as $plugin) {
-                       $contents = $plugin->hook_subscribe_feed($contents, $url, $auth_login, $auth_pass);
-               }
-
                if (is_html($contents)) {
                        $feedUrls = get_feeds_from_html($url, $contents);