]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
make pluginhost a singleton
[tt-rss.git] / include / rssfuncs.php
index 537a4c338c54598bac4f4793a1d03a9c27b2a1e3..9c80a72d6efc7035ac9151fc27afd8cccb516b9f 100644 (file)
                                $updstart_thresh_qpart
                        ORDER BY $random_qpart $query_limit");
 
-               $user_prefs_cache = array();
-
                if($debug) _debug(sprintf("Scheduled %d feeds to update...", db_num_rows($result)));
 
                // Here is a little cache magic in order to minimize risk of double feed updates.
                                        $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT,
                                        $force_refetch ? 0 : max($last_updated_timestamp, $cache_timestamp));
 
+                               global $fetch_curl_used;
+
+                               if (!$fetch_curl_used) {
+                                       $tmp = @gzdecode($feed_data);
+
+                                       if ($tmp) $feed_data = $tmp;
+                               }
+
                                if ($debug_enabled) {
                                        _debug("update_rss_feed: fetch done.");
                                }
                        }
                }
 
-               $pluginhost = new PluginHost(Db::get());
+               $pluginhost = new PluginHost();
                $pluginhost->set_debug($debug_enabled);
                $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
 
-               $pluginhost->load(PLUGINS, $pluginhost::KIND_ALL);
-               $pluginhost->load($user_plugins, $pluginhost::KIND_USER, $owner_uid);
+               $pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
+               $pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
                $pluginhost->load_data();
 
-               foreach ($pluginhost->get_hooks($pluginhost::HOOK_FEED_FETCHED) as $plugin) {
+               foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
                        $feed_data = $plugin->hook_feed_fetched($feed_data);
                }
 
                        }
 
                        // We use local pluginhost here because we need to load different per-user feed plugins
-                       $pluginhost->run_hooks($pluginhost::HOOK_FEED_PARSED, "hook_feed_parsed", $rss);
+                       $pluginhost->run_hooks(PluginHost::HOOK_FEED_PARSED, "hook_feed_parsed", $rss);
 
                        if ($debug_enabled) {
                                _debug("update_rss_feed: processing feed data...");
                                        "author" => $entry_author,
                                        "stored" => $stored_article);
 
-                               foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_FILTER) as $plugin) {
+                               foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) {
                                        $article = $plugin->hook_article_filter($article);
                                }