]> git.wh0rd.org - tt-rss.git/commitdiff
only stop inline feed updates with open_basedir enabled if there are any plugins...
authorAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Tue, 26 Jan 2016 08:45:47 +0000 (11:45 +0300)
committerAndrew Dolgov <noreply@madoka.volgo-balt.ru>
Tue, 26 Jan 2016 08:45:47 +0000 (11:45 +0300)
add plugin->flags() returning array with additional plugin information, currently only CURL requirement (optional)

classes/feeds.php
classes/plugin.php
plugins/af_readability/init.php
plugins/af_redditimgur/init.php
plugins/af_tumblr_1280/init.php
plugins/af_unburn/init.php
plugins/af_zz_imgsetsizes/init.php

index cb1b032d160428eaa2b4ce0844e34fc3bea9e25f..df0fd440b8a1c2422832140d522a79310a333b93 100755 (executable)
@@ -166,12 +166,30 @@ class Feeds extends Handler_Protected {
 
                $method_split = explode(":", $method);
 
-               if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed) && !ini_get("open_basedir")) {
+               if ($method == "ForceUpdate" && $feed > 0 && is_numeric($feed)) {
                        // Update the feed if required with some basic flood control
 
-                       $result = $this->dbh->query(
-                               "SELECT cache_images,".SUBSTRING_FOR_DATE."(last_updated,1,19) AS last_updated
-                                       FROM ttrss_feeds WHERE id = '$feed'");
+                       $any_needs_curl = false;
+
+                       if (ini_get("open_basedir")) {
+                               $pluginhost = PluginHost::getInstance();
+                               foreach ($pluginhost->get_plugins() as $plugin) {
+                                       $flags = $plugin->flags();
+
+                                       if (isset($flags["needs_curl"]) && $flags["needs_curl"]) {
+                                               $any_needs_curl = true;
+                                               break;
+                                       }
+                               }
+                       }
+
+                       //if ($_REQUEST["debug"]) print "<!-- any_needs_curl: $any_needs_curl -->";
+
+                       if (!$any_needs_curl) {
+
+                               $result = $this->dbh->query(
+                                               "SELECT cache_images," . SUBSTRING_FOR_DATE . "(last_updated,1,19) AS last_updated
+                                               FROM ttrss_feeds WHERE id = '$feed'");
 
                                if ($this->dbh->num_rows($result) != 0) {
                                        $last_updated = strtotime($this->dbh->fetch_result($result, 0, "last_updated"));
@@ -182,9 +200,10 @@ class Feeds extends Handler_Protected {
                                                update_rss_feed($feed, true, true);
                                        } else {
                                                $this->dbh->query("UPDATE ttrss_feeds SET last_updated = '1970-01-01', last_update_started = '1970-01-01'
-                                                       WHERE id = '$feed'");
+                                                               WHERE id = '$feed'");
                                        }
                                }
+                       }
                }
 
                if ($method_split[0] == "MarkAllReadGR")  {
index 8fbacf363a82d65de5da8da8be0c73e344a578f9..01ac46bae28bf0814eea624b5f9f47f807bde3fd 100644 (file)
@@ -15,6 +15,13 @@ class Plugin {
                return array(1.0, "plugin", "No description", "No author", false);
        }
 
+       function flags() {
+               /* associative array, possible keys:
+                       needs_curl = boolean
+               */
+               return array();
+       }
+
        function get_js() {
                return "";
        }
index 1d7c638a6365a909d051649e512cc887042e8bf2..a52b745b857f90ca37c1f166f9742cbafd25dbeb 100755 (executable)
@@ -9,6 +9,10 @@ class Af_Readability extends Plugin {
                        "fox");
        }
 
+       function flags() {
+               return array("needs_curl" => true);
+       }
+
        function save() {
                //
        }
index 1ab696ce3ff955bd183471f7e077feb0b8ce7933..67ee0c989ac3751b7e86c8ea4b2284c45ccdf93f 100755 (executable)
@@ -8,6 +8,10 @@ class Af_RedditImgur extends Plugin {
                        "fox");
        }
 
+       function flags() {
+               return array("needs_curl" => true);
+       }
+
        function init($host) {
                $this->host = $host;
 
index 985d8c5f889568fe1e7e011e8153271ec7ff30bd..dbdc78e9364f8033a8e8594d597a062571685430 100755 (executable)
@@ -8,6 +8,10 @@ class Af_Tumblr_1280 extends Plugin {
                        "fox");
        }
 
+       function flags() {
+               return array("needs_curl" => true);
+       }
+
        function init($host) {
                $this->host = $host;
 
index 72f8a2606aad81ec036ed3cd9c0c7a677b29e1c5..e5f43e40aafa9b86892ff999fe79acc57d881ae8 100755 (executable)
@@ -8,6 +8,10 @@ class Af_Unburn extends Plugin {
                        "fox");
        }
 
+       function flags() {
+               return array("needs_curl" => true);
+       }
+
        function init($host) {
                $this->host = $host;
 
index 96afbbfe0c47edbbace30082139965d66bbf0ed7..cdfd06338d95b6689bb0aefb030325d3a7dace14 100644 (file)
@@ -8,6 +8,10 @@ class Af_Zz_ImgSetSizes extends Plugin {
                        "fox");
        }
 
+       function flags() {
+               return array("needs_curl" => true);
+       }
+
        function init($host) {
                $this->host = $host;