diff --git a/app/handlers/feed.php b/app/handlers/feed.php index 24e5bd7..d0d136e 100644 --- a/app/handlers/feed.php +++ b/app/handlers/feed.php @@ -157,8 +157,9 @@ function fetch_favicon($feed_id, $site_url, $icon_link) { if (Helper\bool_config('favicons') && ! Model\Favicon\has_favicon($feed_id)) { $favicon = new Favicon(); + $icon_url = $favicon->find($site_url, $icon_link); - if ($favicon->find($site_url, $icon_link)) { + if (! empty($icon_url)) { Model\Favicon\create_feed_favicon($feed_id, $favicon->getType(), $favicon->getContent()); } } diff --git a/composer.json b/composer.json index da2e610..dc6124b 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "fguillot/simple-validator": "v1.0.0", "fguillot/json-rpc": "v1.2.3", "fguillot/picodb": "v1.0.14 ", - "fguillot/picofeed": "v0.1.29", + "fguillot/picofeed": "v0.1.30", "pda/pheanstalk": "v3.1.0", "ircmaxell/password-compat": "^1.0.4" }, diff --git a/composer.lock b/composer.lock index 9eb467c..53118d2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "a1111f43530dee7323d23b4fe76637b0", - "content-hash": "957098eb24a77f8299716d34353d0fc8", + "hash": "c801ae93ae28d98a0c8786921d325a53", + "content-hash": "6f772b24ec9a4cc603ef6060b3df7865", "packages": [ { "name": "fguillot/json-rpc", @@ -88,16 +88,16 @@ }, { "name": "fguillot/picofeed", - "version": "v0.1.29", + "version": "v0.1.30", "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "03a0a603173f5d5916d54fd6b8191a3981f949e7" + "reference": "f39a9ec07ee73c969f1c4a7d08c9e319a7f290d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/03a0a603173f5d5916d54fd6b8191a3981f949e7", - "reference": "03a0a603173f5d5916d54fd6b8191a3981f949e7", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/f39a9ec07ee73c969f1c4a7d08c9e319a7f290d7", + "reference": "f39a9ec07ee73c969f1c4a7d08c9e319a7f290d7", "shasum": "" }, "require": { @@ -137,7 +137,7 @@ ], "description": "Modern library to handle RSS/Atom feeds", "homepage": "https://github.com/fguillot/picoFeed", - "time": "2017-01-09 23:10:47" + "time": "2017-01-15 20:30:23" }, { "name": "fguillot/simple-validator", diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 53d10fd..bd5b88e 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -265,17 +265,17 @@ }, { "name": "fguillot/picofeed", - "version": "v0.1.29", - "version_normalized": "0.1.29.0", + "version": "v0.1.30", + "version_normalized": "0.1.30.0", "source": { "type": "git", "url": "https://github.com/fguillot/picoFeed.git", - "reference": "03a0a603173f5d5916d54fd6b8191a3981f949e7" + "reference": "f39a9ec07ee73c969f1c4a7d08c9e319a7f290d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/03a0a603173f5d5916d54fd6b8191a3981f949e7", - "reference": "03a0a603173f5d5916d54fd6b8191a3981f949e7", + "url": "https://api.github.com/repos/fguillot/picoFeed/zipball/f39a9ec07ee73c969f1c4a7d08c9e319a7f290d7", + "reference": "f39a9ec07ee73c969f1c4a7d08c9e319a7f290d7", "shasum": "" }, "require": { @@ -295,7 +295,7 @@ "suggest": { "ext-curl": "PicoFeed will use cURL if present" }, - "time": "2017-01-09 23:10:47", + "time": "2017-01-15 20:30:23", "bin": [ "picofeed" ], diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php index e704b25..634b01e 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Client/Curl.php @@ -111,7 +111,7 @@ class Curl extends Client } // Do not work with PHP-FPM - if (substr(PHP_SAPI, 0, 3) !== 'cgi') { + if (strpos(PHP_SAPI, 'cgi') !== false) { header(':', true, $status); } diff --git a/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Favicon.php b/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Favicon.php index 09feb49..56940b2 100644 --- a/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Favicon.php +++ b/vendor/fguillot/picofeed/lib/PicoFeed/Reader/Favicon.php @@ -95,8 +95,7 @@ class Favicon extends Base * Download and check if a resource exists. * * @param string $url URL - * - * @return \PicoFeed\Client Client instance + * @return \PicoFeed\Client\Client Client instance */ public function download($url) { @@ -118,7 +117,6 @@ class Favicon extends Base * Check if a remote file exists. * * @param string $url URL - * * @return bool */ public function exists($url) @@ -131,7 +129,6 @@ class Favicon extends Base * * @param string $website_link URL * @param string $favicon_link optional URL - * * @return string */ public function find($website_link, $favicon_link = '') @@ -165,7 +162,6 @@ class Favicon extends Base * Extract the icon links from the HTML. * * @param string $html HTML - * * @return array */ public function extract($html) diff --git a/vendor/fguillot/picofeed/picofeed b/vendor/fguillot/picofeed/picofeed index b1a8d80..8f35737 100755 --- a/vendor/fguillot/picofeed/picofeed +++ b/vendor/fguillot/picofeed/picofeed @@ -4,6 +4,7 @@ require_once 'vendor/autoload.php'; use PicoFeed\Config\Config; +use PicoFeed\Reader\Favicon; use PicoFeed\Scraper\Scraper; use PicoFeed\Reader\Reader; use PicoFeed\Logging\Logger; @@ -92,6 +93,12 @@ function grabber($url) echo $grabber->getFilteredContent().PHP_EOL; } +function fetch_favicon($url) +{ + $favicon = new Favicon(); + echo $favicon->find($url) . PHP_EOL; +} + // Parse command line arguments if ($argc === 4) { switch ($argv[1]) { @@ -102,8 +109,7 @@ if ($argc === 4) { nofilter_item($argv[2], $argv[3]); die; } -} -else if ($argc === 3) { +} else if ($argc === 3) { switch ($argv[1]) { case 'feed': dump_feed($argv[2]); @@ -114,6 +120,9 @@ else if ($argc === 3) { case 'grabber': grabber($argv[2]); die; + case 'favicon': + fetch_favicon($argv[2]); + die; } } @@ -123,3 +132,4 @@ printf("%s debug \n", $argv[0]); printf("%s item \n", $argv[0]); printf("%s nofilter \n", $argv[0]); printf("%s grabber \n", $argv[0]); +printf("%s favicon \n", $argv[0]);